| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "allegro/file.h" | ||
| 2 | #include "base/flags.h" | ||
| 3 | #include "base/general.h" | ||
| 4 | #include "base/util.h" | ||
| 5 | #include "base/version.h" | ||
| 6 | #include "base/zapp.h" | ||
| 7 | #include "base/qrs.h" | ||
| 8 | #include "base/cpool.h" | ||
| 9 | #include "base/autocombo.h" | ||
| 10 | #include "base/packfile.h" | ||
| 11 | #include "base/dmap.h" | ||
| 12 | #include "base/combo.h" | ||
| 13 | #include "base/msgstr.h" | ||
| 14 | #include "base/flags.h" | ||
| 15 | #include <bit> | ||
| 16 | #include <filesystem> | ||
| 17 | #include <memory> | ||
| 18 | #include <optional> | ||
| 19 | #include <stdio.h> | ||
| 20 | #include <cstring> | ||
| 21 | #include <string> | ||
| 22 | #include <map> | ||
| 23 | #include <vector> | ||
| 24 | #include <assert.h> | ||
| 25 | #include <fmt/format.h> | ||
| 26 | |||
| 27 | |||
| 28 | #include "fmt/core.h" | ||
| 29 | #include "base/zc_alleg.h" | ||
| 30 | #include "base/zdefs.h" | ||
| 31 | #include "base/colors.h" | ||
| 32 | #include "tiles.h" | ||
| 33 | #include "base/zsys.h" | ||
| 34 | #include "base/qst.h" | ||
| 35 | #include "defdata.h" | ||
| 36 | #include "subscr.h" | ||
| 37 | #include "sfx.h" | ||
| 38 | #include "base/md5.h" | ||
| 39 | #include "zc/replay.h" | ||
| 40 | #include "zc/zelda.h" | ||
| 41 | #include "zinfo.h" | ||
| 42 | #include "zc/ffscript.h" | ||
| 43 | #include "particles.h" | ||
| 44 | #include "base/misctypes.h" | ||
| 45 | #include "base/initdata.h" | ||
| 46 | #include "advanced_music.h" | ||
| 47 | |||
| 48 | extern sprite_list guys, items, Ewpns, Lwpns, chainlinks, decorations; | ||
| 49 | extern void setZScriptVersion(int32_t s_version); | ||
| 50 | |||
| 51 | static bool read_ext_zinfo = false, read_zinfo = false; | ||
| 52 | static bool loadquest_report = false; | ||
| 53 | static char const* loading_qst_name = NULL; | ||
| 54 | static std::string last_loaded_qstpath; | ||
| 55 | static byte loading_qst_num = 0; | ||
| 56 | static byte subscr_mode = ssdtMAX; | ||
| 57 | // Very old quests only used a byte for combos, and each screen had a "combo page" to vary | ||
| 58 | // what combos were used. This vector just lets us convert those old quests on load. | ||
| 59 | static std::vector<byte> old_combo_pages; | ||
| 60 | |||
| 61 | dword loading_tileset_flags = 0; | ||
| 62 | |||
| 63 | int32_t First[MAX_COMBO_COLS]={0},combo_alistpos[MAX_COMBO_COLS]={0},combo_pool_listpos[MAX_COMBO_COLS]={0},combo_auto_listpos[MAX_COMBO_COLS]={0}; | ||
| 64 | map_and_screen map_page[MAX_MAPPAGE_BTNS]= {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}}; | ||
| 65 | |||
| 66 | #ifdef _MSC_VER | ||
| 67 | #define strncasecmp _strnicmp | ||
| 68 | #endif | ||
| 69 | |||
| 70 | #ifndef _AL_MALLOC | ||
| 71 | #define _AL_MALLOC(a) _al_malloc(a) | ||
| 72 | #define _AL_FREE(a) _al_free(a) | ||
| 73 | #endif | ||
| 74 | |||
| 75 | using std::string; | ||
| 76 | using std::pair; | ||
| 77 | |||
| 78 | extern int32_t hero_animation_speed; //lower is faster animation | ||
| 79 | extern byte *colordata; | ||
| 80 | extern tiledata *newtilebuf; | ||
| 81 | extern byte *trashbuf; | ||
| 82 | extern itemdata *itemsbuf; | ||
| 83 | extern wpndata *wpnsbuf; | ||
| 84 | extern comboclass *combo_class_buf; | ||
| 85 | extern guydata *guysbuf; | ||
| 86 | extern ZCHEATS zcheats; | ||
| 87 | extern char palnames[MAXLEVELS][17]; | ||
| 88 | extern char *byte_conversion(int32_t number, int32_t format); | ||
| 89 | extern char *byte_conversion2(int32_t number1, int32_t number2, int32_t format1, int32_t format2); | ||
| 90 | string zScript; | ||
| 91 | 441 | std::map<int32_t, script_slot_data > ffcmap; | |
| 92 | 441 | std::map<int32_t, script_slot_data > globalmap; | |
| 93 | 441 | std::map<int32_t, script_slot_data > genericmap; | |
| 94 | 441 | std::map<int32_t, script_slot_data > itemmap; | |
| 95 | 441 | std::map<int32_t, script_slot_data > npcmap; | |
| 96 | 441 | std::map<int32_t, script_slot_data > ewpnmap; | |
| 97 | 441 | std::map<int32_t, script_slot_data > lwpnmap; | |
| 98 | 441 | std::map<int32_t, script_slot_data > playermap; | |
| 99 | 441 | std::map<int32_t, script_slot_data > dmapmap; | |
| 100 | 441 | std::map<int32_t, script_slot_data > screenmap; | |
| 101 | 441 | std::map<int32_t, script_slot_data > itemspritemap; | |
| 102 | 441 | std::map<int32_t, script_slot_data > comboscriptmap; | |
| 103 | 441 | std::map<int32_t, script_slot_data > subscreenmap; | |
| 104 | void free_newtilebuf(); | ||
| 105 | bool combosread=false; | ||
| 106 | bool mapsread=false; | ||
| 107 | bool fixffcs=false; | ||
| 108 | bool fixpolsvoice=false; | ||
| 109 | |||
| 110 | // Each section had a separate, secondary versioning number, but it was never really utilized for | ||
| 111 | // its intended purpose so it's been removed. But we still write something in this field. | ||
| 112 | 241 | bool write_deprecated_section_cversion(word section_version, PACKFILE* f) | |
| 113 | { | ||
| 114 | 241 | return p_iputw(section_version, f); | |
| 115 | } | ||
| 116 | |||
| 117 | 15232 | bool read_deprecated_section_cversion(PACKFILE* f) | |
| 118 | { | ||
| 119 | word unused; | ||
| 120 | 15232 | return p_igetw(&unused, f); | |
| 121 | } | ||
| 122 | |||
| 123 | 22012 | void script_slot_data::update() | |
| 124 | { | ||
| 125 |
2/3✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 22005 times.
|
22012 | switch (format) |
| 126 | { | ||
| 127 | case SCRIPT_FORMAT_INVALID: | ||
| 128 | 7 | output = fmt::format("{} --{}", slotname, scriptname); | |
| 129 | 7 | break; | |
| 130 | 22005 | case SCRIPT_FORMAT_DEFAULT: | |
| 131 | default: | ||
| 132 | 22005 | output = fmt::format("{} {}", slotname, scriptname); | |
| 133 | 22005 | } | |
| 134 | 22012 | } | |
| 135 | |||
| 136 | char qstdat_string[2048] = { 0 }; | ||
| 137 | |||
| 138 | static zinfo* load_tmp_zi = NULL; | ||
| 139 | |||
| 140 | int32_t memDBGwatch[8]= {0,0,0,0,0,0,0,0}; //So I can monitor memory crap | ||
| 141 | const byte clavio[9]={97,109,111,110,103,117,115,0}; | ||
| 142 | |||
| 143 | //enum { qe_OK, qe_notfound, qe_invalid, qe_version, qe_obsolete, | ||
| 144 | // qe_missing, qe_internal, qe_pwd, qe_match, qe_minver }; | ||
| 145 | |||
| 146 | const char *qst_error[] = | ||
| 147 | { | ||
| 148 | "OK","File not found","Invalid quest file", | ||
| 149 | "Version not supported","Obsolete version", | ||
| 150 | "Missing new data" , /* but let it pass in ZQuest */ | ||
| 151 | "Internal error occurred", "Invalid password", | ||
| 152 | "Quest title doesn't match saved game", "Save file is for older version of quest; please start new save", | ||
| 153 | "Out of memory", "File Debug Mode", "Canceled", "", "No quest assigned" | ||
| 154 | }; | ||
| 155 | |||
| 156 | //for legacy quests -DD | ||
| 157 | enum { ssiBOMB, ssiSWORD, ssiSHIELD, ssiCANDLE, ssiLETTER, ssiPOTION, ssiLETTERPOTION, ssiBOW, ssiARROW, ssiBOWANDARROW, ssiBAIT, ssiRING, ssiBRACELET, ssiMAP, | ||
| 158 | ssiCOMPASS, ssiBOSSKEY, ssiMAGICKEY, ssiBRANG, ssiWAND, ssiRAFT, ssiLADDER, ssiWHISTLE, ssiBOOK, ssiWALLET, ssiSBOMB, ssiHCPIECE, ssiAMULET, ssiFLIPPERS, | ||
| 159 | ssiHOOKSHOT, ssiLENS, ssiHAMMER, ssiBOOTS, ssiDIVINEFIRE, ssiDIVINEESCAPE, ssiDIVINEPROTECTION, ssiQUIVER, ssiBOMBBAG, ssiCBYRNA, ssiROCS, ssiHOVERBOOTS, | ||
| 160 | ssiSPINSCROLL, ssiCROSSSCROLL, ssiQUAKESCROLL, ssiWHISPRING, ssiCHARGERING, ssiPERILSCROLL, ssiWEALTHMEDAL, ssiHEARTRING, ssiMAGICRING, ssiSPINSCROLL2, | ||
| 161 | ssiQUAKESCROLL2, ssiAGONY, ssiSTOMPBOOTS, ssiWHIMSICALRING, ssiPERILRING, ssiMAX | ||
| 162 | }; | ||
| 163 | |||
| 164 | static byte deprecated_rules[QUESTRULES_NEW_SIZE]; | ||
| 165 | |||
| 166 | |||
| 167 | ✗ | char *byte_conversion(int32_t number, int32_t format) | |
| 168 | { | ||
| 169 | static char num_str[40]; | ||
| 170 | |||
| 171 | ✗ | if(format==-1) //auto | |
| 172 | { | ||
| 173 | ✗ | format=1; //bytes | |
| 174 | |||
| 175 | ✗ | if(number>1024) | |
| 176 | { | ||
| 177 | ✗ | format=2; //kilobytes | |
| 178 | ✗ | } | |
| 179 | |||
| 180 | ✗ | if(number>1024*1024) | |
| 181 | { | ||
| 182 | ✗ | format=3; //megabytes | |
| 183 | ✗ | } | |
| 184 | |||
| 185 | ✗ | if(number>1024*1024*1024) | |
| 186 | { | ||
| 187 | ✗ | format=4; //gigabytes (dude, what are you doing?) | |
| 188 | ✗ | } | |
| 189 | ✗ | } | |
| 190 | |||
| 191 | ✗ | switch(format) | |
| 192 | { | ||
| 193 | case 1: //bytes | ||
| 194 | ✗ | sprintf(num_str,"%db",number); | |
| 195 | ✗ | break; | |
| 196 | |||
| 197 | case 2: //kilobytes | ||
| 198 | ✗ | sprintf(num_str,"%.2fk",float(number)/1024); | |
| 199 | ✗ | break; | |
| 200 | |||
| 201 | case 3: //megabytes | ||
| 202 | ✗ | sprintf(num_str,"%.2fM",float(number)/(1024*1024)); | |
| 203 | ✗ | break; | |
| 204 | |||
| 205 | case 4: //gigabytes | ||
| 206 | ✗ | sprintf(num_str,"%.2fG",float(number)/(1024*1024*1024)); | |
| 207 | ✗ | break; | |
| 208 | |||
| 209 | default: | ||
| 210 | ✗ | abort(); | |
| 211 | break; | ||
| 212 | } | ||
| 213 | |||
| 214 | ✗ | return num_str; | |
| 215 | } | ||
| 216 | |||
| 217 | ✗ | char *byte_conversion2(int32_t number1, int32_t number2, int32_t format1, int32_t format2) | |
| 218 | { | ||
| 219 | static char num_str1[40]; | ||
| 220 | static char num_str2[40]; | ||
| 221 | static char num_str[80]; | ||
| 222 | |||
| 223 | ✗ | if(format1==-1) //auto | |
| 224 | { | ||
| 225 | ✗ | format1=1; //bytes | |
| 226 | |||
| 227 | ✗ | if(number1>1024) | |
| 228 | { | ||
| 229 | ✗ | format1=2; //kilobytes | |
| 230 | ✗ | } | |
| 231 | |||
| 232 | ✗ | if(number1>1024*1024) | |
| 233 | { | ||
| 234 | ✗ | format1=3; //megabytes | |
| 235 | ✗ | } | |
| 236 | |||
| 237 | ✗ | if(number1>1024*1024*1024) | |
| 238 | { | ||
| 239 | ✗ | format1=4; //gigabytes (dude, what are you doing?) | |
| 240 | ✗ | } | |
| 241 | ✗ | } | |
| 242 | |||
| 243 | ✗ | if(format2==-1) //auto | |
| 244 | { | ||
| 245 | ✗ | format2=1; //bytes | |
| 246 | |||
| 247 | ✗ | if(number2>1024) | |
| 248 | { | ||
| 249 | ✗ | format2=2; //kilobytes | |
| 250 | ✗ | } | |
| 251 | |||
| 252 | ✗ | if(number2>1024*1024) | |
| 253 | { | ||
| 254 | ✗ | format2=3; //megabytes | |
| 255 | ✗ | } | |
| 256 | |||
| 257 | ✗ | if(number2>1024*1024*1024) | |
| 258 | { | ||
| 259 | ✗ | format2=4; //gigabytes (dude, what are you doing?) | |
| 260 | ✗ | } | |
| 261 | ✗ | } | |
| 262 | |||
| 263 | ✗ | switch(format1) | |
| 264 | { | ||
| 265 | case 1: //bytes | ||
| 266 | ✗ | sprintf(num_str1,"%db",number1); | |
| 267 | ✗ | break; | |
| 268 | |||
| 269 | case 2: //kilobytes | ||
| 270 | ✗ | sprintf(num_str1,"%.2fk",float(number1)/1024); | |
| 271 | ✗ | break; | |
| 272 | |||
| 273 | case 3: //megabytes | ||
| 274 | ✗ | sprintf(num_str1,"%.2fM",float(number1)/(1024*1024)); | |
| 275 | ✗ | break; | |
| 276 | |||
| 277 | case 4: //gigabytes | ||
| 278 | ✗ | sprintf(num_str1,"%.2fG",float(number1)/(1024*1024*1024)); | |
| 279 | ✗ | break; | |
| 280 | |||
| 281 | default: | ||
| 282 | ✗ | abort(); | |
| 283 | break; | ||
| 284 | } | ||
| 285 | |||
| 286 | ✗ | switch(format2) | |
| 287 | { | ||
| 288 | case 1: //bytes | ||
| 289 | ✗ | sprintf(num_str2,"%db",number2); | |
| 290 | ✗ | break; | |
| 291 | |||
| 292 | case 2: //kilobytes | ||
| 293 | ✗ | sprintf(num_str2,"%.2fk",float(number2)/1024); | |
| 294 | ✗ | break; | |
| 295 | |||
| 296 | case 3: //megabytes | ||
| 297 | ✗ | sprintf(num_str2,"%.2fM",float(number2)/(1024*1024)); | |
| 298 | ✗ | break; | |
| 299 | |||
| 300 | case 4: //gigabytes | ||
| 301 | ✗ | sprintf(num_str2,"%.2fG",float(number2)/(1024*1024*1024)); | |
| 302 | ✗ | break; | |
| 303 | |||
| 304 | default: | ||
| 305 | ✗ | abort(); | |
| 306 | break; | ||
| 307 | } | ||
| 308 | |||
| 309 | ✗ | sprintf(num_str, "%s/%s", num_str1, num_str2); | |
| 310 | ✗ | return num_str; | |
| 311 | } | ||
| 312 | |||
| 313 | ✗ | char *ordinal(int32_t num) | |
| 314 | { | ||
| 315 | static const char *ending[4] = {"st","nd","rd","th"}; | ||
| 316 | static char ord_str[8]; | ||
| 317 | |||
| 318 | char *end; | ||
| 319 | ✗ | int32_t t=(num%100)/10; | |
| 320 | ✗ | int32_t n=num%10; | |
| 321 | |||
| 322 | ✗ | if(n>=1 && n<4 && t!=1) | |
| 323 | ✗ | end = (char *)ending[n-1]; | |
| 324 | else | ||
| 325 | ✗ | end = (char *)ending[3]; | |
| 326 | |||
| 327 | ✗ | sprintf(ord_str,"%d%s",num%10000,end); | |
| 328 | ✗ | return ord_str; | |
| 329 | } | ||
| 330 | |||
| 331 | ✗ | int32_t get_version_and_build(PACKFILE *f, word *version, word *build) | |
| 332 | { | ||
| 333 | int32_t ret; | ||
| 334 | ✗ | *version=0; | |
| 335 | ✗ | *build=0; | |
| 336 | ✗ | byte temp_map_count=map_count; | |
| 337 | byte temp_midi_flags[MIDIFLAGS_SIZE]; | ||
| 338 | ✗ | memcpy(temp_midi_flags, midi_flags, MIDIFLAGS_SIZE); | |
| 339 | |||
| 340 | ✗ | zquestheader tempheader{}; | |
| 341 | |||
| 342 | ✗ | if(!f) | |
| 343 | { | ||
| 344 | ✗ | return qe_invalid; | |
| 345 | } | ||
| 346 | |||
| 347 | ✗ | ret=readheader(f, &tempheader); | |
| 348 | |||
| 349 | ✗ | if(ret) | |
| 350 | { | ||
| 351 | ✗ | return ret; | |
| 352 | } | ||
| 353 | |||
| 354 | ✗ | map_count=temp_map_count; | |
| 355 | ✗ | memcpy(midi_flags, temp_midi_flags, MIDIFLAGS_SIZE); | |
| 356 | ✗ | *version=tempheader.zelda_version; | |
| 357 | ✗ | *build=tempheader.build; | |
| 358 | ✗ | return 0; | |
| 359 | ✗ | } | |
| 360 | |||
| 361 | |||
| 362 | ✗ | bool find_section(PACKFILE *f, int32_t section_id_requested) | |
| 363 | { | ||
| 364 | |||
| 365 | ✗ | if(!f) | |
| 366 | { | ||
| 367 | ✗ | return false; | |
| 368 | } | ||
| 369 | |||
| 370 | int32_t section_id_read; | ||
| 371 | ✗ | bool catchup=false; | |
| 372 | word dummy; | ||
| 373 | byte tempbyte; | ||
| 374 | char tempbuf[65536]; | ||
| 375 | |||
| 376 | |||
| 377 | ✗ | switch(section_id_requested) | |
| 378 | { | ||
| 379 | case ID_RULES: | ||
| 380 | case ID_STRINGS: | ||
| 381 | case ID_MISC: | ||
| 382 | case ID_TILES: | ||
| 383 | case ID_COMBOS: | ||
| 384 | case ID_CSETS: | ||
| 385 | case ID_MAPS: | ||
| 386 | case ID_DMAPS: | ||
| 387 | case ID_DOORS: | ||
| 388 | case ID_ITEMS: | ||
| 389 | case ID_WEAPONS: | ||
| 390 | case ID_COLORS: | ||
| 391 | case ID_ICONS: | ||
| 392 | case ID_INITDATA: | ||
| 393 | case ID_GUYS: | ||
| 394 | case ID_MIDIS: | ||
| 395 | case ID_CHEATS: | ||
| 396 | ✗ | break; | |
| 397 | |||
| 398 | default: | ||
| 399 | ✗ | al_trace("Bad section requested!\n"); | |
| 400 | ✗ | return false; | |
| 401 | break; | ||
| 402 | } | ||
| 403 | |||
| 404 | dword section_size; | ||
| 405 | |||
| 406 | //section id | ||
| 407 | ✗ | if(!p_mgetl(§ion_id_read,f)) | |
| 408 | { | ||
| 409 | ✗ | return false; | |
| 410 | } | ||
| 411 | |||
| 412 | ✗ | while(!pack_feof(f)) | |
| 413 | { | ||
| 414 | ✗ | switch(section_id_read) | |
| 415 | { | ||
| 416 | case ID_RULES: | ||
| 417 | case ID_STRINGS: | ||
| 418 | case ID_MISC: | ||
| 419 | case ID_TILES: | ||
| 420 | case ID_COMBOS: | ||
| 421 | case ID_CSETS: | ||
| 422 | case ID_MAPS: | ||
| 423 | case ID_DMAPS: | ||
| 424 | case ID_DOORS: | ||
| 425 | case ID_ITEMS: | ||
| 426 | case ID_WEAPONS: | ||
| 427 | case ID_COLORS: | ||
| 428 | case ID_ICONS: | ||
| 429 | case ID_INITDATA: | ||
| 430 | case ID_GUYS: | ||
| 431 | case ID_MIDIS: | ||
| 432 | case ID_CHEATS: | ||
| 433 | ✗ | catchup=false; | |
| 434 | ✗ | break; | |
| 435 | |||
| 436 | default: | ||
| 437 | ✗ | break; | |
| 438 | } | ||
| 439 | |||
| 440 | |||
| 441 | ✗ | while(catchup) | |
| 442 | { | ||
| 443 | //section id | ||
| 444 | ✗ | section_id_read=(section_id_read<<8); | |
| 445 | |||
| 446 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 447 | { | ||
| 448 | ✗ | return false; | |
| 449 | } | ||
| 450 | |||
| 451 | ✗ | section_id_read+=tempbyte; | |
| 452 | } | ||
| 453 | |||
| 454 | ✗ | if(section_id_read==section_id_requested) | |
| 455 | { | ||
| 456 | ✗ | return true; | |
| 457 | } | ||
| 458 | else | ||
| 459 | { | ||
| 460 | //section version info | ||
| 461 | ✗ | if(!p_igetw(&dummy,f)) | |
| 462 | { | ||
| 463 | ✗ | return false; | |
| 464 | } | ||
| 465 | |||
| 466 | ✗ | if(!p_igetw(&dummy,f)) | |
| 467 | { | ||
| 468 | ✗ | return false; | |
| 469 | } | ||
| 470 | |||
| 471 | //section size | ||
| 472 | ✗ | if(!p_igetl(§ion_size,f)) | |
| 473 | { | ||
| 474 | ✗ | return false; | |
| 475 | } | ||
| 476 | |||
| 477 | //pack_fseek(f, section_size); | ||
| 478 | ✗ | while(section_size>65535) | |
| 479 | { | ||
| 480 | ✗ | pfread(tempbuf,65535,f); | |
| 481 | ✗ | tempbuf[65535]=0; | |
| 482 | ✗ | section_size-=65535; | |
| 483 | } | ||
| 484 | |||
| 485 | ✗ | if(section_size>0) | |
| 486 | { | ||
| 487 | ✗ | pfread(tempbuf,section_size,f); | |
| 488 | ✗ | tempbuf[section_size]=0; | |
| 489 | ✗ | } | |
| 490 | } | ||
| 491 | |||
| 492 | //section id | ||
| 493 | ✗ | if(!p_mgetl(§ion_id_read,f)) | |
| 494 | { | ||
| 495 | ✗ | return false; | |
| 496 | } | ||
| 497 | } | ||
| 498 | |||
| 499 | ✗ | return false; | |
| 500 | ✗ | } | |
| 501 | |||
| 502 | |||
| 503 | |||
| 504 | |||
| 505 | |||
| 506 | ✗ | bool valid_zqt(PACKFILE *f) | |
| 507 | { | ||
| 508 | |||
| 509 | //word tiles_used; | ||
| 510 | //word combos_used; | ||
| 511 | //open the file | ||
| 512 | //PACKFILE *f = pack_fopen(path, F_READ_PACKED); | ||
| 513 | ✗ | if(!f) | |
| 514 | ✗ | return false; | |
| 515 | |||
| 516 | //for now, everything else is valid | ||
| 517 | ✗ | return true; | |
| 518 | |||
| 519 | /*int16_t version; | ||
| 520 | byte build; | ||
| 521 | |||
| 522 | //read the version and make sure it worked | ||
| 523 | if(!p_igetw(&version,f)) | ||
| 524 | { | ||
| 525 | goto error; | ||
| 526 | } | ||
| 527 | |||
| 528 | //read the build and make sure it worked | ||
| 529 | if(!p_getc(&build,f)) | ||
| 530 | goto error; | ||
| 531 | |||
| 532 | //read the tile info and make sure it worked | ||
| 533 | if(!p_igetw(&tiles_used,f)) | ||
| 534 | { | ||
| 535 | goto error; | ||
| 536 | } | ||
| 537 | |||
| 538 | for (int32_t i=0; i<tiles_used; i++) | ||
| 539 | { | ||
| 540 | if(!pfread(trashbuf,tilesize(tf4Bit),f)) | ||
| 541 | { | ||
| 542 | goto error; | ||
| 543 | } | ||
| 544 | } | ||
| 545 | |||
| 546 | //read the combo info and make sure it worked | ||
| 547 | if(!p_igetw(&combos_used,f)) | ||
| 548 | { | ||
| 549 | goto error; | ||
| 550 | } | ||
| 551 | for (int32_t i=0; i<combos_used; i++) | ||
| 552 | { | ||
| 553 | if(!pfread(trashbuf,sizeof(newcombo),f)) | ||
| 554 | { | ||
| 555 | goto error; | ||
| 556 | } | ||
| 557 | } | ||
| 558 | |||
| 559 | //read the palette info and make sure it worked | ||
| 560 | for (int32_t i=0; i<48; i++) | ||
| 561 | { | ||
| 562 | if(!pfread(trashbuf,newpdTOTAL,f)) | ||
| 563 | { | ||
| 564 | goto error; | ||
| 565 | } | ||
| 566 | } | ||
| 567 | if(!pfread(trashbuf,sizeof(palcycle)*256*3,f)) | ||
| 568 | { | ||
| 569 | goto error; | ||
| 570 | } | ||
| 571 | for (int32_t i=0; i<MAXLEVELS; i++) | ||
| 572 | { | ||
| 573 | if(!pfread(trashbuf,PALNAMESIZE,f)) | ||
| 574 | { | ||
| 575 | goto error; | ||
| 576 | } | ||
| 577 | } | ||
| 578 | |||
| 579 | //read the sprite info and make sure it worked | ||
| 580 | for (int32_t i=0; i<MAXITEMS; i++) | ||
| 581 | { | ||
| 582 | if(!pfread(trashbuf,sizeof(itemdata),f)) | ||
| 583 | { | ||
| 584 | goto error; | ||
| 585 | } | ||
| 586 | } | ||
| 587 | |||
| 588 | for (int32_t i=0; i<MAXWPNS; i++) | ||
| 589 | { | ||
| 590 | if(!pfread(trashbuf,sizeof(wpndata),f)) | ||
| 591 | { | ||
| 592 | goto error; | ||
| 593 | } | ||
| 594 | } | ||
| 595 | |||
| 596 | //read the triforce pieces info and make sure it worked | ||
| 597 | for (int32_t i=0; i<8; ++i) | ||
| 598 | { | ||
| 599 | if(!p_getc(&trashbuf,f)) | ||
| 600 | { | ||
| 601 | goto error; | ||
| 602 | } | ||
| 603 | } | ||
| 604 | |||
| 605 | |||
| 606 | |||
| 607 | //read the game icons info and make sure it worked | ||
| 608 | for (int32_t i=0; i<4; ++i) | ||
| 609 | { | ||
| 610 | if(!p_igetw(&trashbuf,f)) | ||
| 611 | { | ||
| 612 | goto error; | ||
| 613 | } | ||
| 614 | } | ||
| 615 | |||
| 616 | //read the misc colors info and map styles info and make sure it worked | ||
| 617 | if(!pfread(trashbuf,sizeof(zcolors),f)) | ||
| 618 | { | ||
| 619 | goto error; | ||
| 620 | } | ||
| 621 | |||
| 622 | //read the template screens and make sure it worked | ||
| 623 | byte num_maps; | ||
| 624 | if(!p_getc(&num_maps,f)) | ||
| 625 | { | ||
| 626 | goto error; | ||
| 627 | } | ||
| 628 | for (int32_t i=0; i<TEMPLATES; i++) | ||
| 629 | { | ||
| 630 | if(!pfread(trashbuf,sizeof(mapscr),f)) | ||
| 631 | { | ||
| 632 | goto error; | ||
| 633 | } | ||
| 634 | } | ||
| 635 | if (num_maps>1) //dungeon templates | ||
| 636 | { | ||
| 637 | for (int32_t i=0; i<TEMPLATES; i++) | ||
| 638 | { | ||
| 639 | if(!pfread(trashbuf,sizeof(mapscr),f)) | ||
| 640 | { | ||
| 641 | goto error; | ||
| 642 | } | ||
| 643 | } | ||
| 644 | } | ||
| 645 | |||
| 646 | //yay! it worked! close the file and say everything was ok. | ||
| 647 | pack_fclose(f); | ||
| 648 | return true; | ||
| 649 | |||
| 650 | error: | ||
| 651 | pack_fclose(f); | ||
| 652 | return false;*/ | ||
| 653 | ✗ | } | |
| 654 | |||
| 655 | ✗ | bool valid_zqt(const char *filename) | |
| 656 | { | ||
| 657 | ✗ | PACKFILE *f=NULL; | |
| 658 | bool isvalid; | ||
| 659 | int32_t error; | ||
| 660 | ✗ | f=open_quest_file(&error, filename, false); | |
| 661 | |||
| 662 | ✗ | if(!f) | |
| 663 | { | ||
| 664 | // setPackfilePassword(NULL); | ||
| 665 | ✗ | return false; | |
| 666 | } | ||
| 667 | |||
| 668 | ✗ | isvalid=valid_zqt(f); | |
| 669 | |||
| 670 | ✗ | clear_quest_tmpfile(); | |
| 671 | ✗ | pack_fclose(f); | |
| 672 | |||
| 673 | // setPackfilePassword(NULL); | ||
| 674 | ✗ | return isvalid; | |
| 675 | ✗ | } | |
| 676 | |||
| 677 | /* | ||
| 678 | .qst file history | ||
| 679 | |||
| 680 | .qst files have always been compressed using allegro's packfiles. | ||
| 681 | |||
| 682 | At some point, an encoding layer was added. The two layers look like this: | ||
| 683 | |||
| 684 | 1) The top layer is from us. See decode_file_007. | ||
| 685 | [0-24] Preamble "Zelda Classic Quest File" | ||
| 686 | [25-28] Initial decoding seed value. | ||
| 687 | [29-X] Allegro-compressed payload (AKA "packed" file), but XOR'd based on seed value | ||
| 688 | [last 4] Checksum | ||
| 689 | |||
| 690 | 2) The bottom layer is a "compressed packed file" from Allegro 4. The entire payload | ||
| 691 | is XOR'd with a password (datapwd). Once that is undone, the first four bytes are "slh!", | ||
| 692 | followed by a lzss compressed representation of the payload (from allergo' packfile compression). | ||
| 693 | The oldest quests skip the password part. | ||
| 694 | |||
| 695 | Simply, the job of this function is to peel away the top layer. | ||
| 696 | |||
| 697 | With this second layer of encryption, the data isn't any more secure, and adds a significant delay | ||
| 698 | in opening and saving files. There is no version field, so they decryption key is | ||
| 699 | found via trial-by-error (very slow!) | ||
| 700 | |||
| 701 | There are other file types of interest: | ||
| 702 | - .zqt: quest template files, skips top-layer encryption pass | ||
| 703 | - .qsu: "unencoded" (and uncompressed) files; skips encryption and compression (also makes the longtan password moot) | ||
| 704 | - .qu?: same as above. automated backup files | ||
| 705 | - .qb?: same as above. automated backup files | ||
| 706 | - .qt?: compressed and encrypted (or not encrypted, as of May 2023) | ||
| 707 | |||
| 708 | May 2023: .qst files are now saved without the top layer encoding, and no allegro packfile password. The first bytes of these | ||
| 709 | files are now "slh!.AG ZC Enhanced Quest File". | ||
| 710 | The following command will take an existing qst file and upgrade it: `./zquest -unencrypt-qst <input> <output>` | ||
| 711 | */ | ||
| 712 | 830 | PACKFILE *open_quest_file(int32_t *open_error, const char *filename, bool show_progress) | |
| 713 | { | ||
| 714 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | if (show_progress) |
| 715 | { | ||
| 716 | ✗ | box_start(1, "Loading Quest", get_zc_font(font_lfont), font, true); | |
| 717 | ✗ | } | |
| 718 | |||
| 719 | 830 | auto unencrypted_result = try_open_maybe_legacy_encoded_file(filename, ENC_STR, nullptr, QH_NEWIDSTR, QH_IDSTR); | |
| 720 |
2/2✓ Branch 0 taken 336 times.
✓ Branch 1 taken 494 times.
|
830 | if (unencrypted_result.decoded_pf) |
| 721 | 336 | return unencrypted_result.decoded_pf; | |
| 722 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 494 times.
|
494 | if (unencrypted_result.not_found) |
| 723 | { | ||
| 724 | ✗ | *open_error = qe_notfound; | |
| 725 | ✗ | return nullptr; | |
| 726 | } | ||
| 727 | |||
| 728 | // Everything below here is legacy code - recently saved quest files will have | ||
| 729 | // returned by now. | ||
| 730 | // The only replay qst file that is still using this legacy encoding is `link_to_the_zelda.qst`. | ||
| 731 | |||
| 732 | // Note: although this is primarily for loading .qst files, it can also handle all of the | ||
| 733 | // file types mentioned in the comment above. No need to be told if the file being loaded | ||
| 734 | // is encrypted or compressed, we can do some simple and fast checks to determine how to load it. | ||
| 735 | 494 | bool top_layer_compressed = unencrypted_result.top_layer_compressed; | |
| 736 | 494 | bool compressed = unencrypted_result.compressed; | |
| 737 | 494 | bool encrypted = unencrypted_result.encrypted; | |
| 738 | |||
| 739 | char tmpfilename[L_tmpnam]; | ||
| 740 | 494 | temp_name(tmpfilename); | |
| 741 | char percent_done[30]; | ||
| 742 | 494 | int32_t current_method=0; | |
| 743 | |||
| 744 | PACKFILE *f; | ||
| 745 | 494 | const char *passwd= encrypted ? datapwd : ""; | |
| 746 | |||
| 747 | // oldquest flag is set when an unencrypted qst file is suspected. | ||
| 748 | 494 | bool oldquest = false; | |
| 749 | int32_t ret; | ||
| 750 | |||
| 751 |
1/2✓ Branch 0 taken 494 times.
✗ Branch 1 not taken.
|
494 | if(strcmp(filename, "default.qst")!=0) |
| 752 | { | ||
| 753 | 494 | box_out(filename); | |
| 754 | 494 | } | |
| 755 | else | ||
| 756 | { | ||
| 757 | ✗ | box_out("new quest"); // Or whatever | |
| 758 | } | ||
| 759 | 494 | box_out("..."); | |
| 760 | 494 | box_eol(); | |
| 761 | 494 | box_eol(); | |
| 762 | |||
| 763 |
1/2✓ Branch 0 taken 494 times.
✗ Branch 1 not taken.
|
494 | if(encrypted) |
| 764 | { | ||
| 765 | 494 | box_out("Decrypting..."); | |
| 766 | 494 | box_save_x(); | |
| 767 | 494 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_MAX-1, top_layer_compressed, passwd); | |
| 768 | |||
| 769 |
2/2✓ Branch 0 taken 431 times.
✓ Branch 1 taken 63 times.
|
494 | if(ret) |
| 770 | { | ||
| 771 |
1/3✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
63 | switch(ret) |
| 772 | { | ||
| 773 | case 1: | ||
| 774 | ✗ | box_out("error."); | |
| 775 | ✗ | box_eol(); | |
| 776 | ✗ | box_end(true); | |
| 777 | ✗ | *open_error=qe_notfound; | |
| 778 | ✗ | return NULL; | |
| 779 | |||
| 780 | case 2: | ||
| 781 | ✗ | box_out("error."); | |
| 782 | ✗ | box_eol(); | |
| 783 | ✗ | box_end(true); | |
| 784 | ✗ | *open_error=qe_internal; | |
| 785 | ✗ | return NULL; | |
| 786 | // be sure not to delete tmpfilename now... | ||
| 787 | } | ||
| 788 | |||
| 789 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63 times.
|
63 | if(ret==5) //old encryption? |
| 790 | { | ||
| 791 | 63 | current_method++; | |
| 792 | 63 | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 793 | 63 | box_out(percent_done); | |
| 794 | 63 | box_load_x(); | |
| 795 | 63 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_211B9, strstr(filename, ".dat#")!=NULL, passwd); | |
| 796 | 63 | } | |
| 797 | |||
| 798 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63 times.
|
63 | if(ret==5) //old encryption? |
| 799 | { | ||
| 800 | 63 | current_method++; | |
| 801 | 63 | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 802 | 63 | box_out(percent_done); | |
| 803 | 63 | box_load_x(); | |
| 804 | 63 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_192B185, strstr(filename, ".dat#")!=NULL, passwd); | |
| 805 | 63 | } | |
| 806 | |||
| 807 |
2/2✓ Branch 0 taken 45 times.
✓ Branch 1 taken 18 times.
|
63 | if(ret==5) //old encryption? |
| 808 | { | ||
| 809 | 18 | current_method++; | |
| 810 | 18 | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 811 | 18 | box_out(percent_done); | |
| 812 | 18 | box_load_x(); | |
| 813 | 18 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_192B105, strstr(filename, ".dat#")!=NULL, passwd); | |
| 814 | 18 | } | |
| 815 | |||
| 816 |
2/2✓ Branch 0 taken 51 times.
✓ Branch 1 taken 12 times.
|
63 | if(ret==5) //old encryption? |
| 817 | { | ||
| 818 | 12 | current_method++; | |
| 819 | 12 | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 820 | 12 | box_out(percent_done); | |
| 821 | 12 | box_load_x(); | |
| 822 | 12 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_192B104, strstr(filename, ".dat#")!=NULL, passwd); | |
| 823 | 12 | } | |
| 824 | |||
| 825 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63 times.
|
63 | if(ret) |
| 826 | { | ||
| 827 | ✗ | oldquest = true; | |
| 828 | ✗ | passwd=""; | |
| 829 | ✗ | } | |
| 830 | 63 | } | |
| 831 | |||
| 832 | 494 | box_out("okay."); | |
| 833 | 494 | box_eol(); | |
| 834 | 494 | } | |
| 835 | else | ||
| 836 | { | ||
| 837 | ✗ | oldquest = true; | |
| 838 | } | ||
| 839 | |||
| 840 | 494 | box_out("Opening..."); | |
| 841 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 494 times.
|
494 | f = pack_fopen_password(oldquest ? filename : tmpfilename, compressed ? F_READ_PACKED : F_READ, passwd); |
| 842 |
1/2✓ Branch 0 taken 494 times.
✗ Branch 1 not taken.
|
494 | if(!f) |
| 843 | { | ||
| 844 | ✗ | if((compressed==1)&&(errno==EDOM)) | |
| 845 | { | ||
| 846 | ✗ | f = pack_fopen_password(oldquest ? filename : tmpfilename, F_READ, passwd); | |
| 847 | ✗ | } | |
| 848 | |||
| 849 | ✗ | if(!f) | |
| 850 | { | ||
| 851 | ✗ | if(!oldquest) | |
| 852 | { | ||
| 853 | ✗ | delete_file(tmpfilename); | |
| 854 | ✗ | } | |
| 855 | ✗ | box_out("error."); | |
| 856 | ✗ | box_eol(); | |
| 857 | ✗ | box_end(true); | |
| 858 | ✗ | *open_error=qe_invalid; | |
| 859 | ✗ | return NULL; | |
| 860 | } | ||
| 861 | ✗ | } | |
| 862 | |||
| 863 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 494 times.
|
494 | if(!oldquest) |
| 864 | { | ||
| 865 | 494 | delete_file(tmpfilename); | |
| 866 | 494 | } | |
| 867 | |||
| 868 | 494 | box_out("okay."); | |
| 869 | 494 | box_eol(); | |
| 870 | |||
| 871 | 494 | return f; | |
| 872 | 830 | } | |
| 873 | |||
| 874 | ✗ | PACKFILE *open_quest_template(zquestheader *Header, const char *filename, bool validate) | |
| 875 | { | ||
| 876 | ✗ | PACKFILE *f=NULL; | |
| 877 | ✗ | int32_t open_error=0; | |
| 878 | |||
| 879 | ✗ | if (Header->templatepath[0] != 0) | |
| 880 | { | ||
| 881 | // TODO: should be safe to remove this, no one seems to use custom quest templates. | ||
| 882 | ✗ | filename=Header->templatepath; | |
| 883 | ✗ | } | |
| 884 | |||
| 885 | ✗ | f=open_quest_file(&open_error, filename, false); | |
| 886 | |||
| 887 | ✗ | if(!f) | |
| 888 | { | ||
| 889 | ✗ | return NULL; | |
| 890 | } | ||
| 891 | |||
| 892 | ✗ | if(validate) | |
| 893 | { | ||
| 894 | ✗ | if(!valid_zqt(f)) | |
| 895 | { | ||
| 896 | ✗ | displayinfo("Error", "Invalid Quest Template"); | |
| 897 | ✗ | pack_fclose(f); | |
| 898 | ✗ | clear_quest_tmpfile(); | |
| 899 | ✗ | return NULL; | |
| 900 | } | ||
| 901 | ✗ | } | |
| 902 | |||
| 903 | ✗ | return f; | |
| 904 | ✗ | } | |
| 905 | |||
| 906 | ✗ | static bool init_section(zquestheader *Header, int32_t section_id, miscQdata *Misc, zctune *tunes, bool validate, const char* filename) | |
| 907 | { | ||
| 908 | // The only time the player uses this is to init tiles for some quests 1.90 or older. See readtiles. | ||
| 909 | ✗ | if (get_app_id() == App::zelda) | |
| 910 | ✗ | assert(section_id == ID_TILES); | |
| 911 | |||
| 912 | ✗ | combosread=false; | |
| 913 | ✗ | mapsread=false; | |
| 914 | ✗ | fixffcs=false; | |
| 915 | |||
| 916 | ✗ | switch(section_id) | |
| 917 | { | ||
| 918 | case ID_RULES: | ||
| 919 | case ID_STRINGS: | ||
| 920 | case ID_MISC: | ||
| 921 | case ID_TILES: | ||
| 922 | case ID_COMBOS: | ||
| 923 | case ID_CSETS: | ||
| 924 | case ID_MAPS: | ||
| 925 | case ID_DMAPS: | ||
| 926 | case ID_DOORS: | ||
| 927 | case ID_ITEMS: | ||
| 928 | case ID_WEAPONS: | ||
| 929 | case ID_COLORS: | ||
| 930 | case ID_ICONS: | ||
| 931 | case ID_INITDATA: | ||
| 932 | case ID_GUYS: | ||
| 933 | case ID_MIDIS: | ||
| 934 | case ID_CHEATS: | ||
| 935 | case ID_ITEMDROPSETS: | ||
| 936 | case ID_FAVORITES: | ||
| 937 | ✗ | break; | |
| 938 | |||
| 939 | default: | ||
| 940 | ✗ | return false; | |
| 941 | break; | ||
| 942 | } | ||
| 943 | |||
| 944 | int32_t ret; | ||
| 945 | word version, build; | ||
| 946 | ✗ | PACKFILE *f=NULL; | |
| 947 | |||
| 948 | //why is this here? | ||
| 949 | /* | ||
| 950 | if(colordata==NULL) | ||
| 951 | return false; | ||
| 952 | */ | ||
| 953 | |||
| 954 | //setPackfilePassword(datapwd); | ||
| 955 | ✗ | f=open_quest_template(Header, filename, validate); | |
| 956 | |||
| 957 | ✗ | if(!f) //no file, nothing to delete | |
| 958 | { | ||
| 959 | // setPackfilePassword(NULL); | ||
| 960 | ✗ | return false; | |
| 961 | } | ||
| 962 | |||
| 963 | ✗ | ret=get_version_and_build(f, &version, &build); | |
| 964 | |||
| 965 | ✗ | if(ret||(version==0)) | |
| 966 | { | ||
| 967 | ✗ | pack_fclose(f); | |
| 968 | ✗ | clear_quest_tmpfile(); | |
| 969 | |||
| 970 | // setPackfilePassword(NULL); | ||
| 971 | ✗ | return false; | |
| 972 | } | ||
| 973 | |||
| 974 | ✗ | if(!find_section(f, section_id)) | |
| 975 | { | ||
| 976 | ✗ | al_trace("Can't find section!\n"); | |
| 977 | ✗ | pack_fclose(f); | |
| 978 | ✗ | clear_quest_tmpfile(); | |
| 979 | |||
| 980 | //setPackfilePassword(NULL); | ||
| 981 | ✗ | return false; | |
| 982 | } | ||
| 983 | |||
| 984 | ✗ | switch(section_id) | |
| 985 | { | ||
| 986 | case ID_RULES: | ||
| 987 | //rules | ||
| 988 | ✗ | ret=readrules(f, Header); | |
| 989 | ✗ | break; | |
| 990 | |||
| 991 | case ID_STRINGS: | ||
| 992 | //strings | ||
| 993 | ✗ | ret=readstrings(f, Header); | |
| 994 | ✗ | break; | |
| 995 | |||
| 996 | case ID_MISC: | ||
| 997 | //misc data | ||
| 998 | ✗ | ret=readmisc(f, Header, Misc); | |
| 999 | ✗ | break; | |
| 1000 | |||
| 1001 | case ID_TILES: | ||
| 1002 | //tiles | ||
| 1003 | ✗ | ret=readtiles(f, newtilebuf, Header, version, build, 0, NEWMAXTILES, true); | |
| 1004 | ✗ | break; | |
| 1005 | |||
| 1006 | case ID_COMBOS: | ||
| 1007 | //combos | ||
| 1008 | ✗ | clear_combos(); | |
| 1009 | ✗ | ret=readcombos(f, Header, version, build, 0, MAXCOMBOS); | |
| 1010 | ✗ | combosread=true; | |
| 1011 | ✗ | break; | |
| 1012 | |||
| 1013 | case ID_COMBOALIASES: | ||
| 1014 | //combos | ||
| 1015 | ✗ | ret=readcomboaliases(f, Header, version, build); | |
| 1016 | ✗ | break; | |
| 1017 | |||
| 1018 | case ID_CSETS: | ||
| 1019 | //color data | ||
| 1020 | ✗ | ret=readcolordata(f, Misc, version, build, 0, newerpdTOTAL); | |
| 1021 | ✗ | break; | |
| 1022 | |||
| 1023 | case ID_MAPS: | ||
| 1024 | //maps | ||
| 1025 | ✗ | ret=readmaps(f, Header); | |
| 1026 | ✗ | mapsread=true; | |
| 1027 | ✗ | break; | |
| 1028 | |||
| 1029 | case ID_DMAPS: | ||
| 1030 | //dmaps | ||
| 1031 | ✗ | ret=readdmaps(f, Header, version, build, 0, MAXDMAPS); | |
| 1032 | ✗ | break; | |
| 1033 | |||
| 1034 | case ID_DOORS: | ||
| 1035 | //door combo sets | ||
| 1036 | ✗ | ret=readdoorcombosets(f, Header); | |
| 1037 | ✗ | break; | |
| 1038 | |||
| 1039 | case ID_ITEMS: | ||
| 1040 | //items | ||
| 1041 | ✗ | ret=readitems(f, version, build); | |
| 1042 | ✗ | break; | |
| 1043 | |||
| 1044 | case ID_WEAPONS: | ||
| 1045 | //weapons | ||
| 1046 | ✗ | ret=readweapons(f, Header); | |
| 1047 | ✗ | break; | |
| 1048 | |||
| 1049 | case ID_COLORS: | ||
| 1050 | //misc. colors | ||
| 1051 | ✗ | ret=readmisccolors(f, Header, Misc); | |
| 1052 | ✗ | break; | |
| 1053 | |||
| 1054 | case ID_ICONS: | ||
| 1055 | //game icons | ||
| 1056 | ✗ | ret=readgameicons(f, Header, Misc); | |
| 1057 | ✗ | break; | |
| 1058 | |||
| 1059 | case ID_INITDATA: | ||
| 1060 | //initialization data | ||
| 1061 | ✗ | ret=readinitdata(f, Header); | |
| 1062 | ✗ | break; | |
| 1063 | |||
| 1064 | case ID_GUYS: | ||
| 1065 | //guys | ||
| 1066 | ✗ | ret=readguys(f, Header); | |
| 1067 | ✗ | break; | |
| 1068 | |||
| 1069 | case ID_MIDIS: | ||
| 1070 | //midis | ||
| 1071 | ✗ | ret=readmidis(f, Header, tunes); | |
| 1072 | ✗ | break; | |
| 1073 | |||
| 1074 | case ID_CHEATS: | ||
| 1075 | //cheat codes | ||
| 1076 | ✗ | ret=readcheatcodes(f, Header); | |
| 1077 | ✗ | break; | |
| 1078 | |||
| 1079 | case ID_ITEMDROPSETS: | ||
| 1080 | //item drop sets | ||
| 1081 | // Why is this one commented out? | ||
| 1082 | //ret=readitemdropsets(f, (int32_t)version, (word)build); | ||
| 1083 | ✗ | break; | |
| 1084 | |||
| 1085 | case ID_FAVORITES: | ||
| 1086 | // favorite combos and aliases | ||
| 1087 | ✗ | ret=readfavorites(f, version); | |
| 1088 | ✗ | break; | |
| 1089 | |||
| 1090 | default: | ||
| 1091 | ✗ | ret=-1; | |
| 1092 | ✗ | break; | |
| 1093 | } | ||
| 1094 | |||
| 1095 | ✗ | pack_fclose(f); | |
| 1096 | ✗ | clear_quest_tmpfile(); | |
| 1097 | |||
| 1098 | //setPackfilePassword(NULL); | ||
| 1099 | ✗ | if(!ret) | |
| 1100 | { | ||
| 1101 | ✗ | return true; | |
| 1102 | } | ||
| 1103 | |||
| 1104 | ✗ | return false; | |
| 1105 | ✗ | } | |
| 1106 | |||
| 1107 | ✗ | bool init_tiles_for_190(bool validate, zquestheader *Header) | |
| 1108 | { | ||
| 1109 | ✗ | return init_section(Header, ID_TILES, NULL, NULL, validate, "assets/190_tiles.qst"); | |
| 1110 | } | ||
| 1111 | |||
| 1112 | ✗ | bool init_tiles(bool validate, zquestheader *Header) | |
| 1113 | { | ||
| 1114 | ✗ | return init_section(Header, ID_TILES, NULL, NULL, validate, "modules/classic/default.qst"); | |
| 1115 | } | ||
| 1116 | |||
| 1117 | ✗ | bool init_combos(bool validate, zquestheader *Header) | |
| 1118 | { | ||
| 1119 | ✗ | return init_section(Header, ID_COMBOS, NULL, NULL, validate, "modules/classic/default.qst"); | |
| 1120 | } | ||
| 1121 | |||
| 1122 | ✗ | bool init_colordata(bool validate, zquestheader *Header, miscQdata *Misc) | |
| 1123 | { | ||
| 1124 | ✗ | return init_section(Header, ID_CSETS, Misc, NULL, validate, "modules/classic/default.qst"); | |
| 1125 | } | ||
| 1126 | |||
| 1127 | 830 | void init_spritelists() | |
| 1128 | { | ||
| 1129 |
2/2✓ Branch 0 taken 615 times.
✓ Branch 1 taken 215 times.
|
830 | if(FFCore.quest_format[vZelda] < 0x255) |
| 1130 | { | ||
| 1131 | 615 | guys.setMax(255); | |
| 1132 | 615 | items.setMax(255); | |
| 1133 | 615 | Ewpns.setMax(255); | |
| 1134 | 615 | Lwpns.setMax(255); | |
| 1135 | 615 | chainlinks.setMax(255); | |
| 1136 | 615 | decorations.setMax(255); | |
| 1137 | 615 | particles.setMax(255); | |
| 1138 | 615 | } | |
| 1139 | else | ||
| 1140 | { | ||
| 1141 | 215 | guys.setMax(255); | |
| 1142 | 215 | items.setMax(255); | |
| 1143 | 215 | Ewpns.setMax(255); | |
| 1144 | 215 | Lwpns.setMax(255); | |
| 1145 | 215 | chainlinks.setMax(255); | |
| 1146 | 215 | decorations.setMax(255); | |
| 1147 | 215 | particles.setMax(255*((255*4)+1)); //255 per sprite that can use particles; guys, items, ewpns, lwpns, +HERO | |
| 1148 | } | ||
| 1149 | 830 | } | |
| 1150 | |||
| 1151 | 325 | bool reset_items(bool validate, zquestheader *Header) | |
| 1152 | { | ||
| 1153 | 325 | bool ret = true; | |
| 1154 |
1/2✓ Branch 0 taken 325 times.
✗ Branch 1 not taken.
|
325 | if (get_app_id() == App::zquest) |
| 1155 | ✗ | ret = init_section(Header, ID_ITEMS, NULL, NULL, validate, "modules/classic/default.qst"); | |
| 1156 | |||
| 1157 |
2/2✓ Branch 0 taken 325 times.
✓ Branch 1 taken 83200 times.
|
83525 | for(int32_t i=0; i<MAXITEMS; i++) reset_itemname(i); |
| 1158 | |||
| 1159 | 325 | return ret; | |
| 1160 | } | ||
| 1161 | |||
| 1162 | ✗ | bool reset_guys() | |
| 1163 | { | ||
| 1164 | // The .dat file's guys definitions are always synchronised with defdata.cpp's - even the tile settings. | ||
| 1165 | ✗ | init_guys(V_GUYS); | |
| 1166 | ✗ | return true; | |
| 1167 | } | ||
| 1168 | |||
| 1169 | ✗ | bool reset_wpns(bool validate, zquestheader *Header) | |
| 1170 | { | ||
| 1171 | ✗ | bool ret = true; | |
| 1172 | ✗ | if (get_app_id() == App::zquest) | |
| 1173 | ✗ | ret = init_section(Header, ID_WEAPONS, NULL, NULL, validate, "modules/classic/default.qst"); | |
| 1174 | |||
| 1175 | ✗ | for(int32_t i=0; i<MAXWPNS; i++) | |
| 1176 | ✗ | reset_weaponname(i); | |
| 1177 | |||
| 1178 | ✗ | return ret; | |
| 1179 | } | ||
| 1180 | |||
| 1181 | ✗ | bool reset_mapstyles(bool validate, miscQdata *Misc) | |
| 1182 | { | ||
| 1183 | ✗ | Misc->colors.blueframe_tile = 20044; | |
| 1184 | ✗ | Misc->colors.blueframe_cset = 0; | |
| 1185 | ✗ | Misc->colors.triforce_tile = 23461; | |
| 1186 | ✗ | Misc->colors.triforce_cset = 1; | |
| 1187 | ✗ | Misc->colors.triframe_tile = 18752; | |
| 1188 | ✗ | Misc->colors.triframe_cset = 1; | |
| 1189 | ✗ | Misc->colors.overworld_map_tile = 16990; | |
| 1190 | ✗ | Misc->colors.overworld_map_cset = 2; | |
| 1191 | ✗ | Misc->colors.HCpieces_tile = 21160; | |
| 1192 | ✗ | Misc->colors.HCpieces_cset = 8; | |
| 1193 | ✗ | Misc->colors.dungeon_map_tile = 19651; | |
| 1194 | ✗ | Misc->colors.dungeon_map_cset = 8; | |
| 1195 | ✗ | return true; | |
| 1196 | } | ||
| 1197 | |||
| 1198 | 1299893 | int32_t read_weap_data(weapon_data& data, PACKFILE* f) | |
| 1199 | { | ||
| 1200 | word v_weapon_data; | ||
| 1201 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1299893 times.
|
1299893 | if(!p_igetw(&v_weapon_data,f)) |
| 1202 | ✗ | return qe_invalid; | |
| 1203 | |||
| 1204 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_igetw(&(data.flags), f)) |
| 1205 | ✗ | return qe_invalid; | |
| 1206 | |||
| 1207 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_igetl(&(data.moveflags), f)) |
| 1208 | ✗ | return qe_invalid; | |
| 1209 | |||
| 1210 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_igetw(&(data.wflags), f)) |
| 1211 | ✗ | return qe_invalid; | |
| 1212 | |||
| 1213 |
2/2✓ Branch 0 taken 6499465 times.
✓ Branch 1 taken 1299893 times.
|
7799358 | for (int32_t q = 0; q < WPNSPR_MAX; ++q) |
| 1214 | { | ||
| 1215 |
1/2✓ Branch 0 taken 6499465 times.
✗ Branch 1 not taken.
|
6499465 | if (!p_getc(&(data.burnsprs[q]), f)) |
| 1216 | ✗ | return qe_invalid; | |
| 1217 |
1/2✓ Branch 0 taken 6499465 times.
✗ Branch 1 not taken.
|
6499465 | if (!p_getc(&(data.light_rads[q]), f)) |
| 1218 | ✗ | return qe_invalid; | |
| 1219 | 6499465 | } | |
| 1220 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_getc(&(data.glow_shape), f)) |
| 1221 | ✗ | return qe_invalid; | |
| 1222 | |||
| 1223 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_igetl(&(data.override_flags), f)) |
| 1224 | ✗ | return qe_invalid; | |
| 1225 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_igetl(&(data.tilew), f)) |
| 1226 | ✗ | return qe_invalid; | |
| 1227 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_igetl(&(data.tileh), f)) |
| 1228 | ✗ | return qe_invalid; | |
| 1229 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_igetl(&(data.hxsz), f)) |
| 1230 | ✗ | return qe_invalid; | |
| 1231 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_igetl(&(data.hysz), f)) |
| 1232 | ✗ | return qe_invalid; | |
| 1233 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_igetl(&(data.hzsz), f)) |
| 1234 | ✗ | return qe_invalid; | |
| 1235 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_igetl(&(data.hxofs), f)) |
| 1236 | ✗ | return qe_invalid; | |
| 1237 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_igetl(&(data.hyofs), f)) |
| 1238 | ✗ | return qe_invalid; | |
| 1239 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_igetl(&(data.xofs), f)) |
| 1240 | ✗ | return qe_invalid; | |
| 1241 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_igetl(&(data.yofs), f)) |
| 1242 | ✗ | return qe_invalid; | |
| 1243 | |||
| 1244 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_igetzf(&(data.step), f)) |
| 1245 | ✗ | return qe_invalid; | |
| 1246 | |||
| 1247 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_getc(&(data.unblockable), f)) |
| 1248 | ✗ | return qe_invalid; | |
| 1249 | |||
| 1250 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_igetl(&(data.timeout), f)) |
| 1251 | ✗ | return qe_invalid; | |
| 1252 | |||
| 1253 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_getc(&(data.imitate_weapon), f)) |
| 1254 | ✗ | return qe_invalid; | |
| 1255 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_getc(&(data.default_defense), f)) |
| 1256 | ✗ | return qe_invalid; | |
| 1257 | |||
| 1258 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_getc(&(data.lift_level), f)) |
| 1259 | ✗ | return qe_invalid; | |
| 1260 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_getc(&(data.lift_time), f)) |
| 1261 | ✗ | return qe_invalid; | |
| 1262 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if (!p_igetzf(&(data.lift_height), f)) |
| 1263 | ✗ | return qe_invalid; | |
| 1264 | |||
| 1265 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if(!p_igetw(&(data.script), f)) |
| 1266 | ✗ | return qe_invalid; | |
| 1267 |
2/2✓ Branch 0 taken 10399144 times.
✓ Branch 1 taken 1299893 times.
|
11699037 | for(uint q = 0; q < 8; ++q) |
| 1268 |
1/2✓ Branch 0 taken 10399144 times.
✗ Branch 1 not taken.
|
10399144 | if(!p_igetl(&(data.initd[q]), f)) |
| 1269 | ✗ | return qe_invalid; | |
| 1270 |
1/2✓ Branch 0 taken 1299893 times.
✗ Branch 1 not taken.
|
1299893 | if(!p_igetw(&(data.pierce_count), f)) |
| 1271 | ✗ | return qe_invalid; | |
| 1272 | 1299893 | return 0; | |
| 1273 | 1299893 | } | |
| 1274 | |||
| 1275 | 444 | int32_t get_qst_buffers() | |
| 1276 | { | ||
| 1277 | 444 | TheMaps.resize(MAPSCRS); | |
| 1278 | 444 | old_combo_pages.resize(MAPSCRS); | |
| 1279 | 444 | map_infos.resize(1); | |
| 1280 | |||
| 1281 | 444 | Z_message("OK\n"); | |
| 1282 | |||
| 1283 | // The vast majority of finished quests (and I presume this will be consistent for all time) use < 1000 strings in total. | ||
| 1284 | // (Shoelace's "Hero of Dreams" uses 1415.) | ||
| 1285 | // So let's be a bit generous and allow 4096 initially. | ||
| 1286 | // In the rare event that a quest overshoots this mark, we'll reallocate to the full 65535 later. | ||
| 1287 | // I tested it and it worked without flaw on 6/6/11. - L. | ||
| 1288 | // 2022: bumped from 4096 to 8192 to avoid a bug where the Strings menu shows (None) strings when the list passes | ||
| 1289 | // this threshold. Possibly some bug related to `msglistcache` to being reset? | ||
| 1290 | // See https://discord.com/channels/876899628556091432/992984989073416242 | ||
| 1291 | 444 | msg_strings_size = 8192; | |
| 1292 | |||
| 1293 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 444 times.
|
444 | MsgStrings = new MsgStr[msg_strings_size]; |
| 1294 | |||
| 1295 | //memset(MsgStrings, 0, sizeof(MsgStr)*msg_strings_size); | ||
| 1296 |
2/2✓ Branch 0 taken 3637248 times.
✓ Branch 1 taken 444 times.
|
3637692 | for(auto q = 0; q < msg_strings_size; ++q) |
| 1297 | { | ||
| 1298 | 3637248 | MsgStrings[q].clear(); | |
| 1299 | 3637248 | } | |
| 1300 | |||
| 1301 |
4/6✓ Branch 0 taken 227328 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 226884 times.
✓ Branch 3 taken 444 times.
✓ Branch 4 taken 444 times.
✗ Branch 5 not taken.
|
227328 | if((DMaps=new dmap[MAXDMAPS])==NULL) |
| 1302 | ✗ | return 0; | |
| 1303 | |||
| 1304 | |||
| 1305 | |||
| 1306 | 444 | combobuf.clear(); | |
| 1307 | 444 | combobuf.resize(MAXCOMBOS); | |
| 1308 | |||
| 1309 | |||
| 1310 |
1/2✓ Branch 0 taken 444 times.
✗ Branch 1 not taken.
|
444 | if((colordata=(byte*)malloc(psTOTAL255))==NULL) |
| 1311 | ✗ | return 0; | |
| 1312 | |||
| 1313 | 444 | free_newtilebuf(); | |
| 1314 |
1/2✓ Branch 0 taken 444 times.
✗ Branch 1 not taken.
|
444 | if((newtilebuf=(tiledata*)malloc(NEWMAXTILES*sizeof(tiledata)))==NULL) |
| 1315 | ✗ | return 0; | |
| 1316 | |||
| 1317 | 444 | memset(newtilebuf, 0, NEWMAXTILES*sizeof(tiledata)); | |
| 1318 | //Z_message("Performed memset on tiles\n"); | ||
| 1319 | 444 | clear_tiles(newtilebuf); | |
| 1320 | //Z_message("Performed clear_tiles()\n"); | ||
| 1321 | |||
| 1322 |
2/2✓ Branch 0 taken 429 times.
✓ Branch 1 taken 15 times.
|
444 | if (get_app_id() == App::zquest) |
| 1323 | { | ||
| 1324 |
1/2✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
|
15 | if((grabtilebuf=(tiledata*)malloc(NEWMAXTILES*sizeof(tiledata)))==NULL) |
| 1325 | ✗ | return 0; | |
| 1326 | |||
| 1327 | 15 | memset(grabtilebuf, 0, NEWMAXTILES*sizeof(tiledata)); | |
| 1328 | 15 | clear_tiles(grabtilebuf); | |
| 1329 | 15 | } | |
| 1330 | |||
| 1331 |
1/2✓ Branch 0 taken 444 times.
✗ Branch 1 not taken.
|
444 | if((trashbuf=(byte*)malloc(100000))==NULL) |
| 1332 | ✗ | return 0; | |
| 1333 | |||
| 1334 | // Big, ugly band-aid here. Perhaps the most common cause of random crashes | ||
| 1335 | // has been inadvertently accessing itemsbuf[-1]. All such crashes should be | ||
| 1336 | // fixed by ensuring there's actually itemdata there. | ||
| 1337 | // If you change this, be sure to update del_qst_buffers, too. | ||
| 1338 | |||
| 1339 |
1/2✓ Branch 0 taken 444 times.
✗ Branch 1 not taken.
|
444 | if((itemsbuf=(itemdata*)malloc(sizeof(itemdata)*(MAXITEMS+1)))==NULL) |
| 1340 | ✗ | return 0; | |
| 1341 | |||
| 1342 |
2/2✓ Branch 0 taken 114108 times.
✓ Branch 1 taken 444 times.
|
114552 | for(size_t q = 0; q < MAXITEMS+1; ++q) |
| 1343 | 114108 | itemsbuf[q].clear(); | |
| 1344 | 444 | itemsbuf++; | |
| 1345 | |||
| 1346 |
1/2✓ Branch 0 taken 444 times.
✗ Branch 1 not taken.
|
444 | if((wpnsbuf=(wpndata*)malloc(sizeof(wpndata)*MAXWPNS))==NULL) |
| 1347 | ✗ | return 0; | |
| 1348 | |||
| 1349 | 444 | memset(wpnsbuf,0,sizeof(wpndata)*MAXWPNS); | |
| 1350 | |||
| 1351 |
1/2✓ Branch 0 taken 444 times.
✗ Branch 1 not taken.
|
444 | if((guysbuf=(guydata*)malloc(sizeof(guydata)*MAXGUYS))==NULL) |
| 1352 | ✗ | return 0; | |
| 1353 | |||
| 1354 |
2/2✓ Branch 0 taken 227328 times.
✓ Branch 1 taken 444 times.
|
227772 | for(size_t q = 0; q < MAXGUYS; ++q) |
| 1355 | 227328 | guysbuf[q].clear(); | |
| 1356 | |||
| 1357 |
1/2✓ Branch 0 taken 444 times.
✗ Branch 1 not taken.
|
444 | if((combo_class_buf=(comboclass*)malloc(sizeof(comboclass)*cMAX))==NULL) |
| 1358 | ✗ | return 0; | |
| 1359 | |||
| 1360 | 444 | return 1; | |
| 1361 | 444 | } | |
| 1362 | |||
| 1363 | |||
| 1364 | 780 | void free_newtilebuf() | |
| 1365 | { | ||
| 1366 |
2/2✓ Branch 0 taken 339 times.
✓ Branch 1 taken 441 times.
|
780 | if(newtilebuf) |
| 1367 | { | ||
| 1368 |
2/2✓ Branch 0 taken 72715500 times.
✓ Branch 1 taken 339 times.
|
72715839 | for(int32_t i=0; i<NEWMAXTILES; i++) |
| 1369 |
2/2✓ Branch 0 taken 643500 times.
✓ Branch 1 taken 72072000 times.
|
144787500 | if(newtilebuf[i].data) |
| 1370 | 72072000 | free(newtilebuf[i].data); | |
| 1371 | |||
| 1372 | 339 | free(newtilebuf); | |
| 1373 | 339 | newtilebuf = 0; | |
| 1374 | 339 | } | |
| 1375 | 780 | } | |
| 1376 | |||
| 1377 | 336 | void free_grabtilebuf() | |
| 1378 | { | ||
| 1379 |
2/2✓ Branch 0 taken 325 times.
✓ Branch 1 taken 11 times.
|
336 | if (get_app_id() == App::zquest) |
| 1380 | { | ||
| 1381 |
1/2✓ Branch 0 taken 11 times.
✗ Branch 1 not taken.
|
11 | if(grabtilebuf) |
| 1382 | { | ||
| 1383 |
2/2✓ Branch 0 taken 2359500 times.
✓ Branch 1 taken 11 times.
|
2359511 | for(int32_t i=0; i<NEWMAXTILES; i++) |
| 1384 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2359500 times.
|
2359500 | if(grabtilebuf[i].data) free(grabtilebuf[i].data); |
| 1385 | |||
| 1386 | 11 | free(grabtilebuf); | |
| 1387 | 11 | grabtilebuf = 0; | |
| 1388 | 11 | } | |
| 1389 | 11 | } | |
| 1390 | 336 | } | |
| 1391 | |||
| 1392 | 336 | void del_qst_buffers() | |
| 1393 | { | ||
| 1394 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 336 times.
✓ Branch 2 taken 336 times.
✗ Branch 3 not taken.
|
336 | if(MsgStrings) delete[] MsgStrings; |
| 1395 | |||
| 1396 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 336 times.
✓ Branch 2 taken 336 times.
✗ Branch 3 not taken.
|
336 | if (DMaps) delete[] DMaps; |
| 1397 | |||
| 1398 | 336 | combobuf.clear(); | |
| 1399 | |||
| 1400 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 336 times.
|
336 | if(colordata) free(colordata); |
| 1401 | |||
| 1402 | 336 | free_newtilebuf(); | |
| 1403 | 336 | free_grabtilebuf(); | |
| 1404 | |||
| 1405 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 336 times.
|
336 | if(trashbuf) free(trashbuf); |
| 1406 | |||
| 1407 | // See get_qst_buffers | ||
| 1408 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 336 times.
|
336 | if(itemsbuf) |
| 1409 | { | ||
| 1410 | 336 | itemsbuf--; | |
| 1411 | 336 | free(itemsbuf); | |
| 1412 | 336 | } | |
| 1413 | |||
| 1414 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 336 times.
|
336 | if(wpnsbuf) free(wpnsbuf); |
| 1415 | |||
| 1416 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 336 times.
|
336 | if(guysbuf) free(guysbuf); |
| 1417 | |||
| 1418 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 336 times.
|
336 | if(combo_class_buf) free(combo_class_buf); |
| 1419 | 336 | } | |
| 1420 | |||
| 1421 | 18 | bool init_palnames() | |
| 1422 | { | ||
| 1423 | // if(palnames==NULL) | ||
| 1424 | // return false; | ||
| 1425 | |||
| 1426 |
2/2✓ Branch 0 taken 9216 times.
✓ Branch 1 taken 18 times.
|
9234 | for(int32_t x=0; x<MAXLEVELS; x++) |
| 1427 | { | ||
| 1428 |
4/4✓ Branch 0 taken 9162 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 18 times.
|
9216 | switch(x) |
| 1429 | { | ||
| 1430 | case 0: | ||
| 1431 | 18 | sprintf(palnames[x],"Overworld"); | |
| 1432 | 18 | break; | |
| 1433 | |||
| 1434 | case 10: | ||
| 1435 | 18 | sprintf(palnames[x],"Caves"); | |
| 1436 | 18 | break; | |
| 1437 | |||
| 1438 | case 11: | ||
| 1439 | 18 | sprintf(palnames[x],"Passageways"); | |
| 1440 | 18 | break; | |
| 1441 | |||
| 1442 | default: | ||
| 1443 | 9162 | sprintf(palnames[x],"%c",0); | |
| 1444 | 9162 | break; | |
| 1445 | } | ||
| 1446 | 9216 | } | |
| 1447 | |||
| 1448 | 18 | return true; | |
| 1449 | } | ||
| 1450 | |||
| 1451 | 100115 | static void *read_block(PACKFILE *f, int32_t size, int32_t alloc_size) | |
| 1452 | { | ||
| 1453 | void *p; | ||
| 1454 | |||
| 1455 |
1/2✓ Branch 0 taken 100115 times.
✗ Branch 1 not taken.
|
100115 | p = _AL_MALLOC(MAX(size, alloc_size)); |
| 1456 | |||
| 1457 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100115 times.
|
100115 | if(!p) |
| 1458 | { | ||
| 1459 | ✗ | return NULL; | |
| 1460 | } | ||
| 1461 | |||
| 1462 |
1/2✓ Branch 0 taken 100115 times.
✗ Branch 1 not taken.
|
100115 | if(!pfread(p,size,f)) |
| 1463 | { | ||
| 1464 | ✗ | _AL_FREE(p); | |
| 1465 | ✗ | return NULL; | |
| 1466 | } | ||
| 1467 | |||
| 1468 |
1/2✓ Branch 0 taken 100115 times.
✗ Branch 1 not taken.
|
100115 | if(pack_ferror(f)) |
| 1469 | { | ||
| 1470 | ✗ | _AL_FREE(p); | |
| 1471 | ✗ | return NULL; | |
| 1472 | } | ||
| 1473 | |||
| 1474 | 100115 | return p; | |
| 1475 | 100115 | } | |
| 1476 | |||
| 1477 | // Only use for reading parts of older quests (Header->zelda_version <= 0x192) | ||
| 1478 | static const byte* legacy_skip_flags; | ||
| 1479 | |||
| 1480 | /* read_midi: | ||
| 1481 | * Reads MIDI data from a datafile (this is not the same thing as the | ||
| 1482 | * standard midi file format). | ||
| 1483 | */ | ||
| 1484 | |||
| 1485 | 10271 | static MIDI *read_midi(PACKFILE *f) | |
| 1486 | { | ||
| 1487 | MIDI *m; | ||
| 1488 | int32_t c; | ||
| 1489 | 10271 | int16_t divisions=0; | |
| 1490 | 10271 | int32_t len=0; | |
| 1491 | |||
| 1492 | 10271 | m = (MIDI*)_AL_MALLOC(sizeof(MIDI)); | |
| 1493 | |||
| 1494 |
1/2✓ Branch 0 taken 10271 times.
✗ Branch 1 not taken.
|
10271 | if(!m) |
| 1495 | { | ||
| 1496 | ✗ | return NULL; | |
| 1497 | } | ||
| 1498 | |||
| 1499 |
2/2✓ Branch 0 taken 328672 times.
✓ Branch 1 taken 10271 times.
|
338943 | for(c=0; c<MIDI_TRACKS; c++) |
| 1500 | { | ||
| 1501 | 328672 | m->track[c].len = 0; | |
| 1502 | 328672 | m->track[c].data = NULL; | |
| 1503 | 328672 | } | |
| 1504 | |||
| 1505 | 10271 | p_mgetw(&divisions,f); | |
| 1506 | 10271 | m->divisions=divisions; | |
| 1507 | |||
| 1508 |
2/2✓ Branch 0 taken 328672 times.
✓ Branch 1 taken 10271 times.
|
338943 | for(c=0; c<MIDI_TRACKS; c++) |
| 1509 | { | ||
| 1510 | 328672 | p_mgetl(&len,f); | |
| 1511 | 328672 | m->track[c].len=len; | |
| 1512 | |||
| 1513 |
2/2✓ Branch 0 taken 228557 times.
✓ Branch 1 taken 100115 times.
|
328672 | if(m->track[c].len > 0) |
| 1514 | { | ||
| 1515 | 100115 | m->track[c].data = (byte*)read_block(f, m->track[c].len, 0); | |
| 1516 | |||
| 1517 |
1/2✓ Branch 0 taken 100115 times.
✗ Branch 1 not taken.
|
100115 | if(!m->track[c].data) |
| 1518 | { | ||
| 1519 | ✗ | destroy_midi(m); | |
| 1520 | ✗ | return NULL; | |
| 1521 | } | ||
| 1522 | 100115 | } | |
| 1523 | 328672 | } | |
| 1524 | |||
| 1525 | LOCK_DATA(m, sizeof(MIDI)); | ||
| 1526 | |||
| 1527 |
2/2✓ Branch 0 taken 328672 times.
✓ Branch 1 taken 10271 times.
|
338943 | for(c=0; c<MIDI_TRACKS; c++) |
| 1528 | { | ||
| 1529 |
2/2✓ Branch 0 taken 100115 times.
✓ Branch 1 taken 228557 times.
|
328672 | if(m->track[c].data) |
| 1530 | { | ||
| 1531 | LOCK_DATA(m->track[c].data, m->track[c].len); | ||
| 1532 | 100115 | } | |
| 1533 | 328672 | } | |
| 1534 | |||
| 1535 | 10271 | return m; | |
| 1536 | 10271 | } | |
| 1537 | |||
| 1538 | ✗ | void clear_combo(int32_t i) | |
| 1539 | { | ||
| 1540 | ✗ | combobuf[i].clear(); | |
| 1541 | ✗ | } | |
| 1542 | |||
| 1543 | ✗ | void clear_combos() | |
| 1544 | { | ||
| 1545 | ✗ | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) | |
| 1546 | ✗ | clear_combo(tmpcounter); | |
| 1547 | ✗ | } | |
| 1548 | |||
| 1549 | ✗ | void pack_combos() | |
| 1550 | { | ||
| 1551 | ✗ | int32_t di = 0; | |
| 1552 | |||
| 1553 | ✗ | for(int32_t si=0; si<1024; si+=2) | |
| 1554 | ✗ | combobuf[di++] = combobuf[si]; | |
| 1555 | |||
| 1556 | ✗ | for(; di<1024; di++) | |
| 1557 | ✗ | clear_combo(di); | |
| 1558 | ✗ | } | |
| 1559 | |||
| 1560 | 496 | void reset_tunes(zctune *tune) | |
| 1561 | { | ||
| 1562 |
2/2✓ Branch 0 taken 124992 times.
✓ Branch 1 taken 496 times.
|
125488 | for(int32_t i=0; i<MAXCUSTOMTUNES; i++) |
| 1563 | { | ||
| 1564 | 124992 | tune[i].reset(); | |
| 1565 | 124992 | } | |
| 1566 | 496 | } | |
| 1567 | |||
| 1568 | int32_t doortranslations_u[9][4]= | ||
| 1569 | { | ||
| 1570 | {37,38,53,54}, | ||
| 1571 | {37,38,39,40}, | ||
| 1572 | {37,38,55,56}, | ||
| 1573 | {37,38,39,40}, | ||
| 1574 | {37,38,53,54}, | ||
| 1575 | {37,38,53,54}, | ||
| 1576 | {37,38,53,54}, | ||
| 1577 | {7,8,23,24}, | ||
| 1578 | {7,8,41,42} | ||
| 1579 | }; | ||
| 1580 | |||
| 1581 | int32_t doortranslations_d[9][4]= | ||
| 1582 | { | ||
| 1583 | {117,118,133,134}, | ||
| 1584 | {135,136,133,134}, | ||
| 1585 | {119,120,133,134}, | ||
| 1586 | {135,136,133,134}, | ||
| 1587 | {117,118,133,134}, | ||
| 1588 | {117,118,133,134}, | ||
| 1589 | {117,118,133,134}, | ||
| 1590 | {151,152,167,168}, | ||
| 1591 | {137,138,167,168}, | ||
| 1592 | }; | ||
| 1593 | |||
| 1594 | //enum {dt_pass=0, dt_lock, dt_shut, dt_boss, dt_olck, dt_osht, dt_obos, dt_wall, dt_bomb, dt_walk, dt_max}; | ||
| 1595 | int32_t doortranslations_l[9][6]= | ||
| 1596 | { | ||
| 1597 | {66,67,82,83,98,99}, | ||
| 1598 | {66,68,82,84,98,100}, | ||
| 1599 | {66,69,82,85,98,101}, | ||
| 1600 | {66,68,82,84,98,100}, | ||
| 1601 | {66,67,82,83,98,99}, | ||
| 1602 | {66,67,82,83,98,99}, | ||
| 1603 | {66,67,82,83,98,99}, | ||
| 1604 | {64,65,80,81,96,97}, | ||
| 1605 | {64,65,80,114,96,97}, | ||
| 1606 | }; | ||
| 1607 | |||
| 1608 | int32_t doortranslations_r[9][6]= | ||
| 1609 | { | ||
| 1610 | |||
| 1611 | {76,77,92,93,108,109}, | ||
| 1612 | {75,77,91,93,107,109}, | ||
| 1613 | {74,77,90,93,106,109}, | ||
| 1614 | {75,77,91,93,107,109}, | ||
| 1615 | {76,77,92,93,108,109}, | ||
| 1616 | {76,77,92,93,108,109}, | ||
| 1617 | {76,77,92,93,108,109}, | ||
| 1618 | {78,79,94,95,110,111}, | ||
| 1619 | {78,79,125,95,110,111}, | ||
| 1620 | }; | ||
| 1621 | |||
| 1622 | 858450 | int32_t tdcmbdat(int32_t map, int32_t scr, int32_t pos) | |
| 1623 | { | ||
| 1624 | 858450 | byte old_cpage = old_combo_pages[map*MAPSCRS+scr]; | |
| 1625 | 858450 | return (TheMaps[map*MAPSCRS+TEMPLATE].data[pos]&0xFF) + (old_cpage<<8); | |
| 1626 | } | ||
| 1627 | |||
| 1628 | 840750 | int32_t tdcmbcset(int32_t map, int32_t scr, int32_t pos) | |
| 1629 | { | ||
| 1630 | //these are here to bypass compiler warnings about unused arguments | ||
| 1631 | 840750 | map=map; | |
| 1632 | 840750 | scr=scr; | |
| 1633 | 840750 | pos=pos; | |
| 1634 | |||
| 1635 | //what does this function do? | ||
| 1636 | // return TheMaps[map*MAPSCRS+TEMPLATE].cset[pos]; | ||
| 1637 | 840750 | return 2; | |
| 1638 | } | ||
| 1639 | |||
| 1640 | 22848 | int32_t MakeDoors(int32_t map, int32_t scr) | |
| 1641 | { | ||
| 1642 |
2/2✓ Branch 0 taken 18423 times.
✓ Branch 1 taken 4425 times.
|
22848 | if(!(TheMaps[map*MAPSCRS+scr].valid&mVALID)) |
| 1643 | { | ||
| 1644 | 18423 | return 0; | |
| 1645 | } | ||
| 1646 | |||
| 1647 | 4425 | DoorComboSet tempdcs{}; | |
| 1648 | |||
| 1649 | //up | ||
| 1650 |
2/2✓ Branch 0 taken 39825 times.
✓ Branch 1 taken 4425 times.
|
44250 | for(int32_t i=0; i<9; i++) |
| 1651 | { | ||
| 1652 |
2/2✓ Branch 0 taken 159300 times.
✓ Branch 1 taken 39825 times.
|
199125 | for(int32_t j=0; j<4; j++) |
| 1653 | { | ||
| 1654 | 159300 | tempdcs.doorcombo_u[i][j]=tdcmbdat(map,scr,doortranslations_u[i][j]); | |
| 1655 | 159300 | tempdcs.doorcset_u[i][j]=tdcmbcset(map,scr,doortranslations_u[i][j]); | |
| 1656 | 159300 | } | |
| 1657 | 39825 | } | |
| 1658 | |||
| 1659 | 4425 | tempdcs.bombdoorcombo_u[0]=tdcmbdat(map,scr,57); | |
| 1660 | 4425 | tempdcs.bombdoorcset_u[0]=tdcmbcset(map,scr,57); | |
| 1661 | 4425 | tempdcs.bombdoorcombo_u[1]=tdcmbdat(map,scr,58); | |
| 1662 | 4425 | tempdcs.bombdoorcset_u[1]=tdcmbcset(map,scr,58); | |
| 1663 | 4425 | tempdcs.walkthroughcombo[0]=tdcmbdat(map,scr,34); | |
| 1664 | 4425 | tempdcs.walkthroughcset[0]=tdcmbdat(map,scr,34); | |
| 1665 | |||
| 1666 | //down | ||
| 1667 |
2/2✓ Branch 0 taken 39825 times.
✓ Branch 1 taken 4425 times.
|
44250 | for(int32_t i=0; i<9; i++) |
| 1668 | { | ||
| 1669 |
2/2✓ Branch 0 taken 159300 times.
✓ Branch 1 taken 39825 times.
|
199125 | for(int32_t j=0; j<4; j++) |
| 1670 | { | ||
| 1671 | 159300 | tempdcs.doorcombo_d[i][j]=tdcmbdat(map,scr,doortranslations_d[i][j]); | |
| 1672 | 159300 | tempdcs.doorcset_d[i][j]=tdcmbcset(map,scr,doortranslations_d[i][j]); | |
| 1673 | 159300 | } | |
| 1674 | 39825 | } | |
| 1675 | |||
| 1676 | 4425 | tempdcs.bombdoorcombo_d[0]=tdcmbdat(map,scr,121); | |
| 1677 | |||
| 1678 | 4425 | tempdcs.bombdoorcset_d[0]=tdcmbcset(map,scr,121); | |
| 1679 | 4425 | tempdcs.bombdoorcombo_d[1]=tdcmbdat(map,scr,122); | |
| 1680 | 4425 | tempdcs.bombdoorcset_d[1]=tdcmbcset(map,scr,122); | |
| 1681 | 4425 | tempdcs.walkthroughcombo[1]=tdcmbdat(map,scr,34); | |
| 1682 | 4425 | tempdcs.walkthroughcset[1]=tdcmbdat(map,scr,34); | |
| 1683 | |||
| 1684 | //left | ||
| 1685 | // TheMaps[i*MAPSCRS+j].warpdmap=TheOldMap.warpdmap; | ||
| 1686 |
2/2✓ Branch 0 taken 39825 times.
✓ Branch 1 taken 4425 times.
|
44250 | for(int32_t i=0; i<9; i++) |
| 1687 | { | ||
| 1688 |
2/2✓ Branch 0 taken 238950 times.
✓ Branch 1 taken 39825 times.
|
278775 | for(int32_t j=0; j<6; j++) |
| 1689 | { | ||
| 1690 | 238950 | tempdcs.doorcombo_l[i][j]=tdcmbdat(map,scr,doortranslations_l[i][j]); | |
| 1691 | 238950 | tempdcs.doorcset_l[i][j]=tdcmbcset(map,scr,doortranslations_l[i][j]); | |
| 1692 | 238950 | } | |
| 1693 | 39825 | } | |
| 1694 | |||
| 1695 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4425 times.
|
4425 | for(int32_t j=0; j>6; j++) |
| 1696 | { | ||
| 1697 | ✗ | if((j!=2)&&(j!=3)) | |
| 1698 | { | ||
| 1699 | ✗ | tempdcs.doorcombo_l[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].data[doortranslations_l[dt_bomb][j]]; | |
| 1700 | ✗ | tempdcs.doorcset_l[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].cset[doortranslations_l[dt_bomb][j]]; | |
| 1701 | ✗ | } | |
| 1702 | ✗ | } | |
| 1703 | |||
| 1704 | 4425 | tempdcs.bombdoorcombo_l[0]=0; | |
| 1705 | 4425 | tempdcs.bombdoorcset_l[0]=tdcmbcset(map,scr,115); | |
| 1706 | 4425 | tempdcs.bombdoorcombo_l[1]=tdcmbdat(map,scr,115); | |
| 1707 | 4425 | tempdcs.bombdoorcset_l[1]=tdcmbcset(map,scr,115); | |
| 1708 | 4425 | tempdcs.bombdoorcombo_l[2]=0; | |
| 1709 | 4425 | tempdcs.bombdoorcset_l[2]=tdcmbcset(map,scr,115); | |
| 1710 | 4425 | tempdcs.walkthroughcombo[2]=tdcmbdat(map,scr,34); | |
| 1711 | 4425 | tempdcs.walkthroughcset[2]=tdcmbdat(map,scr,34); | |
| 1712 | |||
| 1713 | //right | ||
| 1714 |
2/2✓ Branch 0 taken 39825 times.
✓ Branch 1 taken 4425 times.
|
44250 | for(int32_t i=0; i<9; i++) |
| 1715 | { | ||
| 1716 |
2/2✓ Branch 0 taken 238950 times.
✓ Branch 1 taken 39825 times.
|
278775 | for(int32_t j=0; j<6; j++) |
| 1717 | { | ||
| 1718 | 238950 | tempdcs.doorcombo_r[i][j]=tdcmbdat(map,scr,doortranslations_r[i][j]); | |
| 1719 | 238950 | tempdcs.doorcset_r[i][j]=tdcmbcset(map,scr,doortranslations_r[i][j]); | |
| 1720 | 238950 | } | |
| 1721 | 39825 | } | |
| 1722 | |||
| 1723 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4425 times.
|
4425 | for(int32_t j=0; j>6; j++) |
| 1724 | { | ||
| 1725 | ✗ | if((j!=2)&&(j!=3)) | |
| 1726 | { | ||
| 1727 | ✗ | tempdcs.doorcombo_r[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].data[doortranslations_r[dt_bomb][j]]; | |
| 1728 | ✗ | tempdcs.doorcset_r[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].cset[doortranslations_r[dt_bomb][j]]; | |
| 1729 | ✗ | } | |
| 1730 | ✗ | } | |
| 1731 | |||
| 1732 | 4425 | tempdcs.bombdoorcombo_r[0]=0; | |
| 1733 | 4425 | tempdcs.bombdoorcset_r[0]=tdcmbcset(map,scr,124); | |
| 1734 | 4425 | tempdcs.bombdoorcombo_r[1]=tdcmbdat(map,scr,124); | |
| 1735 | 4425 | tempdcs.bombdoorcset_r[1]=tdcmbcset(map,scr,124); | |
| 1736 | 4425 | tempdcs.bombdoorcombo_r[2]=0; | |
| 1737 | 4425 | tempdcs.bombdoorcset_r[2]=tdcmbcset(map,scr,124); | |
| 1738 | 4425 | tempdcs.walkthroughcombo[3]=tdcmbdat(map,scr,34); | |
| 1739 | 4425 | tempdcs.walkthroughcset[3]=tdcmbdat(map,scr,34); | |
| 1740 | |||
| 1741 | int32_t k; | ||
| 1742 | |||
| 1743 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 10306 times.
|
10366 | for(k=0; k<door_combo_set_count; k++) |
| 1744 | { | ||
| 1745 |
2/2✓ Branch 0 taken 5941 times.
✓ Branch 1 taken 4365 times.
|
10306 | if(DoorComboSets[k]==tempdcs) |
| 1746 | { | ||
| 1747 | 4365 | break; | |
| 1748 | } | ||
| 1749 | 5941 | } | |
| 1750 | |||
| 1751 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4425 times.
|
4425 | if (k >= DoorComboSets.size()) |
| 1752 | { | ||
| 1753 | ✗ | return 0; | |
| 1754 | } | ||
| 1755 | |||
| 1756 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 4365 times.
|
4425 | if(k==door_combo_set_count) |
| 1757 | { | ||
| 1758 | 60 | DoorComboSets[k]=tempdcs; | |
| 1759 | 60 | DoorComboSetNames[k] = fmt::format("Door Combo Set {}", k); | |
| 1760 | 60 | ++door_combo_set_count; | |
| 1761 | 60 | } | |
| 1762 | |||
| 1763 | 4425 | return k; | |
| 1764 | /* | ||
| 1765 | doorcombo_u[9][4]; | ||
| 1766 | doorcset_u[9][4]; | ||
| 1767 | doorcombo_d[9][4]; | ||
| 1768 | doorcset_d[9][4]; | ||
| 1769 | doorcombo_l[9][6]; | ||
| 1770 | doorcset_l[9][6]; | ||
| 1771 | doorcombo_r[9][6]; | ||
| 1772 | doorcset_r[9][6]; | ||
| 1773 | bombdoorcombo_u[2]; | ||
| 1774 | bombdoorcset_u[2]; | ||
| 1775 | bombdoorcombo_d[2]; | ||
| 1776 | bombdoorcset_d[2]; | ||
| 1777 | bombdoorcombo_l[3]; | ||
| 1778 | bombdoorcset_l[3]; | ||
| 1779 | bombdoorcombo_r[3]; | ||
| 1780 | bombdoorcset_r[3]; | ||
| 1781 | walkthroughcombo[4]; | ||
| 1782 | walkthroughcset[4]; | ||
| 1783 | */ | ||
| 1784 | 22848 | } | |
| 1785 | |||
| 1786 | 2924544 | INLINE int32_t tcmbdat2(int32_t map, int32_t scr, int32_t pos) | |
| 1787 | { | ||
| 1788 | 2924544 | byte old_cpage = old_combo_pages[map*MAPSCRS+scr]; | |
| 1789 | 2924544 | return (TheMaps[map*MAPSCRS+TEMPLATE2].data[pos]&0xFF) + (old_cpage<<8); | |
| 1790 | } | ||
| 1791 | |||
| 1792 | 2924544 | INLINE int32_t tcmbcset2(int32_t map, int32_t pos) | |
| 1793 | { | ||
| 1794 | |||
| 1795 | 2924544 | return TheMaps[map*MAPSCRS+TEMPLATE2].cset[pos]; | |
| 1796 | } | ||
| 1797 | |||
| 1798 | 2924544 | INLINE int32_t tcmbflag2(int32_t map, int32_t pos) | |
| 1799 | { | ||
| 1800 | 2924544 | return TheMaps[map*MAPSCRS+TEMPLATE2].sflag[pos]; | |
| 1801 | } | ||
| 1802 | |||
| 1803 | |||
| 1804 | 82 | void get_questpwd(char *encrypted_pwd, int16_t pwdkey, char *pwd) | |
| 1805 | { | ||
| 1806 | char temp_pwd[30]; | ||
| 1807 | 82 | memset(temp_pwd,0,30); | |
| 1808 | |||
| 1809 |
2/2✓ Branch 0 taken 74 times.
✓ Branch 1 taken 8 times.
|
82 | if(pwdkey!=0) |
| 1810 | { | ||
| 1811 | 74 | memcpy(temp_pwd,encrypted_pwd,30); | |
| 1812 | 74 | temp_pwd[29]=0; | |
| 1813 | |||
| 1814 |
2/2✓ Branch 0 taken 2220 times.
✓ Branch 1 taken 74 times.
|
2294 | for(int32_t i=0; i<30; i++) |
| 1815 | { | ||
| 1816 | 2220 | temp_pwd[i] -= pwdkey; | |
| 1817 | 2220 | int32_t t=pwdkey>>15; | |
| 1818 | 2220 | pwdkey = (pwdkey<<1)+t; | |
| 1819 | 2220 | } | |
| 1820 | 74 | } | |
| 1821 | |||
| 1822 | 82 | memcpy(pwd,temp_pwd,30); | |
| 1823 | 82 | } | |
| 1824 | |||
| 1825 | |||
| 1826 | 261 | bool devpwd() | |
| 1827 | { | ||
| 1828 | #ifdef _DEBUG | ||
| 1829 | return true; | ||
| 1830 | #endif | ||
| 1831 | #if DEVLEVEL > 3 | ||
| 1832 | return true; | ||
| 1833 | #endif | ||
| 1834 |
1/2✓ Branch 0 taken 261 times.
✗ Branch 1 not taken.
|
261 | return !strcmp(zc_get_config("dev","pwd","",App::zquest), (char*)clavio) || is_ci(); |
| 1835 | } | ||
| 1836 | ✗ | bool check_questpwd(zquestheader *Header, char *pwd) | |
| 1837 | { | ||
| 1838 | ✗ | if(devpwd()) | |
| 1839 | ✗ | return true; | |
| 1840 | ✗ | if((!strcmp(pwd, (char*)clavio))) | |
| 1841 | ✗ | return true; | |
| 1842 | cvs_MD5Context ctx; | ||
| 1843 | uint8_t md5sum[16]; | ||
| 1844 | |||
| 1845 | ✗ | cvs_MD5Init(&ctx); | |
| 1846 | ✗ | cvs_MD5Update(&ctx, (const uint8_t*)pwd, (unsigned)strlen(pwd)); | |
| 1847 | ✗ | cvs_MD5Final(md5sum, &ctx); | |
| 1848 | |||
| 1849 | ✗ | return (memcmp(Header->pwd_hash,md5sum,16)==0); | |
| 1850 | ✗ | } | |
| 1851 | |||
| 1852 | static char const* key_exts[KEYFILE_NUMTY] = {"key", "zcheat", "zpwd"}; | ||
| 1853 | static bool key_hashed[KEYFILE_NUMTY] = {false, true, false}; | ||
| 1854 | static char const* key_namestr[KEYFILE_NUMTY] = {"Master","Cheat","ZPwd"}; | ||
| 1855 | |||
| 1856 | ✗ | static bool check_keyfile(char const* path, char const* ext, bool hashed, char const* typestr, zquestheader* Header) | |
| 1857 | { | ||
| 1858 | char keyfilename[2048]; | ||
| 1859 | ✗ | replace_extension(keyfilename, path, ext, 2047); | |
| 1860 | ✗ | if(!exists(keyfilename)) | |
| 1861 | ✗ | return false; | |
| 1862 | ✗ | bool ret = false; | |
| 1863 | |||
| 1864 | ✗ | char password[QSTPWD_LEN] = {0}, pwd[32] = {0}; | |
| 1865 | ✗ | PACKFILE *fp = pack_fopen_password(keyfilename, F_READ,""); | |
| 1866 | ✗ | char msg[80] = {0}; | |
| 1867 | ✗ | pfread(msg, 80, fp); | |
| 1868 | ✗ | if(strcmp(msg,"ZQuest Auto-Generated Quest Password Key File. DO NOT EDIT!")) | |
| 1869 | { | ||
| 1870 | ✗ | zprint2("Found %s Key File '%s' (invalid header)\n", typestr, keyfilename); | |
| 1871 | ✗ | pack_fclose(fp); | |
| 1872 | ✗ | return false; | |
| 1873 | } | ||
| 1874 | int16_t ver; | ||
| 1875 | byte bld; | ||
| 1876 | ✗ | p_igetw(&ver, fp); | |
| 1877 | ✗ | p_getc(&bld, fp); | |
| 1878 | ✗ | pfread(password, QSTPWD_LEN, fp, true); | |
| 1879 | ✗ | if(hashed) | |
| 1880 | { | ||
| 1881 | ✗ | char unhashed_pw[QSTPWD_LEN] = {0}; | |
| 1882 | |||
| 1883 | ✗ | char hashmap = 'Z'; | |
| 1884 | ✗ | hashmap += 'Q'; | |
| 1885 | ✗ | hashmap += 'U'; | |
| 1886 | ✗ | hashmap += 'E'; | |
| 1887 | ✗ | hashmap += 'S'; | |
| 1888 | ✗ | hashmap += 'T'; | |
| 1889 | |||
| 1890 | ✗ | for ( int32_t q = 0; q < QSTPWD_LEN; ++q ) | |
| 1891 | ✗ | unhashed_pw[q] = password[q] - hashmap; | |
| 1892 | |||
| 1893 | ✗ | ret = check_questpwd(Header, unhashed_pw); | |
| 1894 | ✗ | } | |
| 1895 | ✗ | else ret = check_questpwd(Header, password); | |
| 1896 | ✗ | pack_fclose(fp); | |
| 1897 | ✗ | zprint2("Found %s Key File '%s' (%s access)\n", | |
| 1898 | ✗ | typestr, keyfilename, ret ? "valid" : "invalid"); | |
| 1899 | ✗ | return ret; | |
| 1900 | ✗ | } | |
| 1901 | |||
| 1902 | ✗ | bool check_keyfiles(char const* path, vector<uint> types, zquestheader* Header) | |
| 1903 | { | ||
| 1904 | ✗ | char exedir[PATH_MAX] = {0}; | |
| 1905 | ✗ | extract_name(path, exedir, FILENAMEALL); | |
| 1906 | ✗ | char const* paths[] = {path, exedir}; | |
| 1907 | ✗ | for(uint keyty : types) | |
| 1908 | { | ||
| 1909 | ✗ | if(keyty >= KEYFILE_NUMTY) | |
| 1910 | ✗ | continue; | |
| 1911 | ✗ | for(char const* p : paths) | |
| 1912 | { | ||
| 1913 | ✗ | if(check_keyfile(p, key_exts[keyty], key_hashed[keyty], key_namestr[keyty], Header)) | |
| 1914 | ✗ | return true; | |
| 1915 | } | ||
| 1916 | } | ||
| 1917 | ✗ | return false; | |
| 1918 | ✗ | } | |
| 1919 | |||
| 1920 | 497 | void print_quest_metadata(zquestheader const& tempheader, char const* path, byte qst_num) | |
| 1921 | { | ||
| 1922 | 497 | zprint2("\n"); | |
| 1923 | 497 | zprint2("[QUEST METADATA]\n"); | |
| 1924 |
1/2✓ Branch 0 taken 497 times.
✗ Branch 1 not taken.
|
497 | if(path) |
| 1925 | 497 | zprint2("Path: %s\n", path); | |
| 1926 |
2/2✓ Branch 0 taken 369 times.
✓ Branch 1 taken 128 times.
|
497 | if(tempheader.title[0]) |
| 1927 | 369 | zprint2("Title: %s\n", tempheader.title); | |
| 1928 | 497 | zprint2("ZC Version: %s\n", tempheader.getVerStr()); | |
| 1929 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 282 times.
|
497 | if(tempheader.new_version_id_date_day) |
| 1930 | 215 | zprint2("ZC Build Date: %d-%d-%d %s %s\n", tempheader.new_version_id_date_year, tempheader.new_version_id_date_month, tempheader.new_version_id_date_day, tempheader.build_timestamp, tempheader.build_timezone); | |
| 1931 |
2/2✓ Branch 0 taken 278 times.
✓ Branch 1 taken 219 times.
|
497 | if(tempheader.version[0]) |
| 1932 | 278 | zprint2("Qst Version: %s\n", tempheader.version); | |
| 1933 |
2/2✓ Branch 0 taken 369 times.
✓ Branch 1 taken 128 times.
|
497 | if(tempheader.author[0]) |
| 1934 | 369 | zprint2("Author: %s\n", tempheader.author); | |
| 1935 | 497 | zprint2("\n"); | |
| 1936 | 497 | } | |
| 1937 | |||
| 1938 | 842 | int32_t readheader(PACKFILE *f, zquestheader *Header, byte printmetadata) | |
| 1939 | { | ||
| 1940 | int32_t dummy; | ||
| 1941 | 842 | zquestheader tempheader{}; | |
| 1942 |
2/2✓ Branch 0 taken 830 times.
✓ Branch 1 taken 12 times.
|
842 | tempheader.filename = Header->filename; |
| 1943 | char dummybuf[80]; | ||
| 1944 | byte temp_map_count; | ||
| 1945 | byte temp_midi_flags[MIDIFLAGS_SIZE]; | ||
| 1946 | word version; | ||
| 1947 | char temp_pwd[30], temp_pwd2[30]; | ||
| 1948 | int16_t temp_pwdkey; | ||
| 1949 | cvs_MD5Context ctx; | ||
| 1950 | 830 | memset(temp_midi_flags, 0, MIDIFLAGS_SIZE); | |
| 1951 | 830 | memset(FFCore.quest_format, 0, sizeof(FFCore.quest_format)); | |
| 1952 | |||
| 1953 | |||
| 1954 | |||
| 1955 |
2/4✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 830 times.
|
830 | if(!pfread(tempheader.id_str,sizeof(tempheader.id_str),f)) // first read old header |
| 1956 | { | ||
| 1957 | ✗ | Z_message("Unable to read header string\n"); | |
| 1958 | ✗ | return qe_invalid; | |
| 1959 | } | ||
| 1960 | |||
| 1961 | // check header | ||
| 1962 |
2/2✓ Branch 0 taken 806 times.
✓ Branch 1 taken 24 times.
|
830 | if(strcmp(tempheader.id_str,QH_NEWIDSTR)) |
| 1963 | { | ||
| 1964 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(strcmp(tempheader.id_str,QH_IDSTR)) |
| 1965 | { | ||
| 1966 | ✗ | Z_message("Invalid header string: '%s' (was expecting '%s' or '%s')\n", tempheader.id_str, QH_IDSTR, QH_NEWIDSTR); | |
| 1967 | ✗ | return qe_invalid; | |
| 1968 | } | ||
| 1969 | 24 | } | |
| 1970 | |||
| 1971 | 830 | int32_t templatepath_len=0; | |
| 1972 | |||
| 1973 | 830 | tempheader.external_zinfo = false; | |
| 1974 | 830 | read_zinfo = false; | |
| 1975 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 806 times.
|
830 | if(!strcmp(tempheader.id_str,QH_IDSTR)) //pre-1.93 version |
| 1976 | { | ||
| 1977 | byte padding; | ||
| 1978 | |||
| 1979 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_getc(&padding,f)) |
| 1980 | { | ||
| 1981 | ✗ | return qe_invalid; | |
| 1982 | } | ||
| 1983 | |||
| 1984 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_igetw(&tempheader.zelda_version,f)) |
| 1985 | { | ||
| 1986 | ✗ | return qe_invalid; | |
| 1987 | } | ||
| 1988 | |||
| 1989 | 24 | FFCore.quest_format[vZelda] = tempheader.zelda_version; | |
| 1990 | |||
| 1991 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(tempheader.zelda_version > ZELDA_VERSION) |
| 1992 | { | ||
| 1993 | ✗ | return qe_version; | |
| 1994 | } | ||
| 1995 | |||
| 1996 | 24 | FFCore.quest_format[vZelda] = tempheader.zelda_version; | |
| 1997 | |||
| 1998 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(strcmp(tempheader.id_str,QH_IDSTR)) |
| 1999 | { | ||
| 2000 | ✗ | return qe_invalid; | |
| 2001 | } | ||
| 2002 | |||
| 2003 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(bad_version(tempheader.zelda_version)) |
| 2004 | { | ||
| 2005 | ✗ | return qe_obsolete; | |
| 2006 | } | ||
| 2007 | |||
| 2008 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_igetw(&tempheader.internal,f)) |
| 2009 | { | ||
| 2010 | ✗ | return qe_invalid; | |
| 2011 | } | ||
| 2012 | |||
| 2013 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_getc(&tempheader.quest_number,f)) |
| 2014 | { | ||
| 2015 | ✗ | return qe_invalid; | |
| 2016 | } | ||
| 2017 | |||
| 2018 | 24 | FFCore.quest_format[qQuestNumber] = tempheader.quest_number; | |
| 2019 | |||
| 2020 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!pfread(&quest_rules[0],2,f)) |
| 2021 | { | ||
| 2022 | ✗ | return qe_invalid; | |
| 2023 | } | ||
| 2024 | |||
| 2025 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_getc(&temp_map_count,f)) |
| 2026 | { | ||
| 2027 | ✗ | return qe_invalid; | |
| 2028 | } | ||
| 2029 | |||
| 2030 | 24 | FFCore.quest_format[qMapCount] = temp_map_count; | |
| 2031 | |||
| 2032 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_getc(&tempheader.old_str_count,f)) |
| 2033 | { | ||
| 2034 | ✗ | return qe_invalid; | |
| 2035 | } | ||
| 2036 | |||
| 2037 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_getc(&tempheader.data_flags[ZQ_TILES],f)) |
| 2038 | { | ||
| 2039 | ✗ | return qe_invalid; | |
| 2040 | } | ||
| 2041 | |||
| 2042 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!pfread(temp_midi_flags,4,f)) |
| 2043 | { | ||
| 2044 | ✗ | return qe_invalid; | |
| 2045 | } | ||
| 2046 | |||
| 2047 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_getc(&tempheader.data_flags[ZQ_CHEATS2],f)) |
| 2048 | { | ||
| 2049 | ✗ | return qe_invalid; | |
| 2050 | } | ||
| 2051 | |||
| 2052 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!pfread(dummybuf,14,f)) |
| 2053 | { | ||
| 2054 | ✗ | return qe_invalid; | |
| 2055 | } | ||
| 2056 | |||
| 2057 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!pfread(&quest_rules[2],2,f)) |
| 2058 | { | ||
| 2059 | ✗ | return qe_invalid; | |
| 2060 | } | ||
| 2061 | |||
| 2062 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_getc(&dummybuf,f)) |
| 2063 | { | ||
| 2064 | ✗ | return qe_invalid; | |
| 2065 | } | ||
| 2066 | |||
| 2067 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!pfread(tempheader.version,9,f)) |
| 2068 | { | ||
| 2069 | ✗ | return qe_invalid; | |
| 2070 | } | ||
| 2071 | |||
| 2072 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!pfread(tempheader.title,sizeof(tempheader.title),f)) |
| 2073 | { | ||
| 2074 | ✗ | return qe_invalid; | |
| 2075 | } | ||
| 2076 | // These fields are expected to end in null bytes! | ||
| 2077 | 24 | tempheader.title[sizeof(tempheader.title)-1] = 0; | |
| 2078 | |||
| 2079 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!pfread(tempheader.author,sizeof(tempheader.author),f)) |
| 2080 | { | ||
| 2081 | ✗ | return qe_invalid; | |
| 2082 | } | ||
| 2083 | 24 | tempheader.author[sizeof(tempheader.author)-1] = 0; | |
| 2084 | |||
| 2085 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_getc(&padding,f)) |
| 2086 | { | ||
| 2087 | ✗ | return qe_invalid; | |
| 2088 | } | ||
| 2089 | |||
| 2090 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_igetw(&temp_pwdkey,f)) |
| 2091 | { | ||
| 2092 | ✗ | return qe_invalid; | |
| 2093 | } | ||
| 2094 | |||
| 2095 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!pfread(temp_pwd,30,f)) |
| 2096 | { | ||
| 2097 | ✗ | return qe_invalid; | |
| 2098 | } | ||
| 2099 | |||
| 2100 | 24 | get_questpwd(temp_pwd, temp_pwdkey, temp_pwd2); | |
| 2101 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | cvs_MD5Init(&ctx); |
| 2102 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | cvs_MD5Update(&ctx, (const uint8_t*)temp_pwd2, (unsigned)strnlen(temp_pwd2, 30)); |
| 2103 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | cvs_MD5Final(tempheader.pwd_hash, &ctx); |
| 2104 | |||
| 2105 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(tempheader.zelda_version < 0x177) // lacks new header stuff... |
| 2106 | { | ||
| 2107 | //memset(tempheader.minver,0,20); // char minver[9], byte build, byte foo[10] | ||
| 2108 | // Not anymore... | ||
| 2109 | ✗ | memset(tempheader.minver,0,17); | |
| 2110 | ✗ | tempheader.build=0; | |
| 2111 | ✗ | tempheader.use_keyfile=0; | |
| 2112 | ✗ | memset(tempheader.old_foo, 0, 9); | |
| 2113 | ✗ | } | |
| 2114 | else | ||
| 2115 | { | ||
| 2116 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!pfread(tempheader.minver,9,f)) |
| 2117 | { | ||
| 2118 | ✗ | return qe_invalid; | |
| 2119 | } | ||
| 2120 | |||
| 2121 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_getc(&tempheader.build,f)) |
| 2122 | { | ||
| 2123 | ✗ | return qe_invalid; | |
| 2124 | } | ||
| 2125 | |||
| 2126 | 24 | FFCore.quest_format[vBuild] = tempheader.build; | |
| 2127 | |||
| 2128 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_getc(&tempheader.use_keyfile,f)) |
| 2129 | { | ||
| 2130 | ✗ | return qe_invalid; | |
| 2131 | } | ||
| 2132 | |||
| 2133 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!pfread(dummybuf,9,f)) |
| 2134 | { | ||
| 2135 | ✗ | return qe_invalid; | |
| 2136 | } | ||
| 2137 | } // starting at minver | ||
| 2138 | |||
| 2139 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 6 times.
|
24 | if(tempheader.zelda_version < 0x187) // lacks newer header stuff... |
| 2140 | { | ||
| 2141 | 6 | memset(&quest_rules[4],0,16); // word rules3..rules10 | |
| 2142 | 6 | } | |
| 2143 | else | ||
| 2144 | { | ||
| 2145 |
2/4✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
|
18 | if(!pfread(&quest_rules[4],16,f)) // read new header additions |
| 2146 | { | ||
| 2147 | ✗ | return qe_invalid; // starting at rules3 | |
| 2148 | } | ||
| 2149 | |||
| 2150 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 6 times.
|
18 | if(tempheader.zelda_version <= 0x190) |
| 2151 | { | ||
| 2152 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | set_qr(qr_MEANPLACEDTRAPS,0); |
| 2153 | 12 | } | |
| 2154 | } | ||
| 2155 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | unpack_qrs(); |
| 2156 | |||
| 2157 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
30 | if((tempheader.zelda_version < 0x192)|| |
| 2158 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((tempheader.zelda_version == 0x192)&&(tempheader.build<149))) |
| 2159 | { | ||
| 2160 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 6 times.
|
24 | set_qr(qr_BRKNSHLDTILES,(get_qr(qr_BRKBLSHLDS_DEP))); |
| 2161 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | set_bit(deprecated_rules,qr_BRKBLSHLDS_DEP,(get_qr(qr_BRKBLSHLDS_DEP))); |
| 2162 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | set_qr(qr_BRKBLSHLDS_DEP,0); |
| 2163 | 18 | } | |
| 2164 | |||
| 2165 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 12 times.
|
18 | if(tempheader.zelda_version >= 0x192) // lacks newer header stuff... |
| 2166 | { | ||
| 2167 | 6 | byte *mf=temp_midi_flags; | |
| 2168 | |||
| 2169 |
3/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 4 times.
|
6 | if((tempheader.zelda_version == 0x192)&&(tempheader.build<178)) |
| 2170 | { | ||
| 2171 | 4 | mf=(byte*)dummybuf; | |
| 2172 | 4 | } | |
| 2173 | |||
| 2174 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | if(!pfread(mf,32,f)) // read new header additions |
| 2175 | { | ||
| 2176 | ✗ | return qe_invalid; // starting at foo2 | |
| 2177 | } | ||
| 2178 | |||
| 2179 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | if(!pfread(dummybuf,18,f)) // read new header additions |
| 2180 | { | ||
| 2181 | ✗ | return qe_invalid; // starting at foo2 | |
| 2182 | } | ||
| 2183 | 6 | } | |
| 2184 | |||
| 2185 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 12 times.
|
24 | if((tempheader.zelda_version < 0x192)|| |
| 2186 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((tempheader.zelda_version == 0x192)&&(tempheader.build<145))) |
| 2187 | { | ||
| 2188 | 18 | memset(tempheader.templatepath,0,2048); | |
| 2189 | 18 | } | |
| 2190 | else | ||
| 2191 | { | ||
| 2192 | ✗ | if(!pfread(tempheader.templatepath,280,f)) // read templatepath | |
| 2193 | { | ||
| 2194 | ✗ | return qe_invalid; | |
| 2195 | } | ||
| 2196 | } | ||
| 2197 | |||
| 2198 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
30 | if((tempheader.zelda_version < 0x192)|| |
| 2199 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((tempheader.zelda_version == 0x192)&&(tempheader.build<186))) |
| 2200 | { | ||
| 2201 | 24 | tempheader.use_keyfile=0; | |
| 2202 | 24 | } | |
| 2203 | 24 | } | |
| 2204 | else | ||
| 2205 | { | ||
| 2206 | //section id | ||
| 2207 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_mgetl(&dummy,f)) |
| 2208 | { | ||
| 2209 | ✗ | return qe_invalid; | |
| 2210 | } | ||
| 2211 | |||
| 2212 | //section version info | ||
| 2213 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_igetw(&version,f)) |
| 2214 | { | ||
| 2215 | ✗ | return qe_invalid; | |
| 2216 | } | ||
| 2217 | |||
| 2218 |
1/2✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
|
806 | if (version > V_HEADER) |
| 2219 | ✗ | return qe_version; | |
| 2220 | |||
| 2221 | 806 | FFCore.quest_format[vHeader] = version; | |
| 2222 | |||
| 2223 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_igetw(&dummy,f)) |
| 2224 | { | ||
| 2225 | ✗ | return qe_invalid; | |
| 2226 | } | ||
| 2227 | |||
| 2228 | //section size | ||
| 2229 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_igetl(&dummy,f)) |
| 2230 | { | ||
| 2231 | ✗ | return qe_invalid; | |
| 2232 | } | ||
| 2233 | |||
| 2234 | //finally... section data | ||
| 2235 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_igetw(&tempheader.zelda_version,f)) |
| 2236 | { | ||
| 2237 | ✗ | return qe_invalid; | |
| 2238 | } | ||
| 2239 | |||
| 2240 | 806 | FFCore.quest_format[vZelda] = tempheader.zelda_version; | |
| 2241 | |||
| 2242 | //do some quick checking... | ||
| 2243 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 806 times.
|
806 | if(tempheader.zelda_version > ZELDA_VERSION) |
| 2244 | { | ||
| 2245 | ✗ | return qe_version; | |
| 2246 | } | ||
| 2247 | |||
| 2248 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 806 times.
|
806 | if(strcmp(tempheader.id_str,QH_NEWIDSTR)) |
| 2249 | { | ||
| 2250 | ✗ | return qe_invalid; | |
| 2251 | } | ||
| 2252 | |||
| 2253 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(bad_version(tempheader.zelda_version)) |
| 2254 | { | ||
| 2255 | ✗ | return qe_obsolete; | |
| 2256 | } | ||
| 2257 | |||
| 2258 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_getc(&tempheader.build,f)) |
| 2259 | { | ||
| 2260 | ✗ | return qe_invalid; | |
| 2261 | } | ||
| 2262 | |||
| 2263 | 806 | FFCore.quest_format[vBuild] = tempheader.build; | |
| 2264 | |||
| 2265 |
2/2✓ Branch 0 taken 58 times.
✓ Branch 1 taken 748 times.
|
806 | if(version<3) |
| 2266 | { | ||
| 2267 |
2/4✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 58 times.
✗ Branch 3 not taken.
|
58 | if(!pfread(temp_pwd,30,f)) |
| 2268 | { | ||
| 2269 | ✗ | return qe_invalid; | |
| 2270 | } | ||
| 2271 | |||
| 2272 |
2/4✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 58 times.
✗ Branch 3 not taken.
|
58 | if(!p_igetw(&temp_pwdkey,f)) |
| 2273 | { | ||
| 2274 | ✗ | return qe_invalid; | |
| 2275 | } | ||
| 2276 | |||
| 2277 | 58 | get_questpwd(temp_pwd, temp_pwdkey, temp_pwd2); | |
| 2278 |
1/2✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
|
58 | cvs_MD5Init(&ctx); |
| 2279 |
1/2✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
|
58 | cvs_MD5Update(&ctx, (const uint8_t*)temp_pwd2, (unsigned)strnlen(temp_pwd2, 30)); |
| 2280 |
1/2✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
|
58 | cvs_MD5Final(tempheader.pwd_hash, &ctx); |
| 2281 | 58 | } | |
| 2282 | else | ||
| 2283 | { | ||
| 2284 |
2/4✓ Branch 0 taken 748 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 748 times.
✗ Branch 3 not taken.
|
748 | if(!pfread(tempheader.pwd_hash,sizeof(tempheader.pwd_hash),f)) |
| 2285 | { | ||
| 2286 | ✗ | return qe_invalid; | |
| 2287 | } | ||
| 2288 | } | ||
| 2289 | |||
| 2290 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_igetw(&tempheader.internal,f)) |
| 2291 | { | ||
| 2292 | ✗ | return qe_invalid; | |
| 2293 | } | ||
| 2294 | |||
| 2295 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_getc(&tempheader.quest_number,f)) |
| 2296 | { | ||
| 2297 | ✗ | return qe_invalid; | |
| 2298 | } | ||
| 2299 | |||
| 2300 | 806 | FFCore.quest_format[qQuestNumber] = tempheader.quest_number; | |
| 2301 | |||
| 2302 | 806 | size_t versz = version < 8 ? 9 : 16; | |
| 2303 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!pfread(tempheader.version,versz,f)) |
| 2304 | { | ||
| 2305 | ✗ | return qe_invalid; | |
| 2306 | } | ||
| 2307 | |||
| 2308 | //FFCore.quest_format[qQuestVersion] = tempheader.version; | ||
| 2309 | //needs to be copied as char[9] or stored as a s.str | ||
| 2310 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!pfread(tempheader.minver,versz,f)) |
| 2311 | { | ||
| 2312 | ✗ | return qe_invalid; | |
| 2313 | } | ||
| 2314 | |||
| 2315 | //FFCore.quest_format[qMinQuestVersion] = tempheader.minver; | ||
| 2316 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!pfread(tempheader.title,sizeof(tempheader.title),f)) |
| 2317 | { | ||
| 2318 | ✗ | return qe_invalid; | |
| 2319 | } | ||
| 2320 | 806 | tempheader.title[sizeof(tempheader.title)-1] = 0; | |
| 2321 | |||
| 2322 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!pfread(tempheader.author,sizeof(tempheader.author),f)) |
| 2323 | { | ||
| 2324 | ✗ | return qe_invalid; | |
| 2325 | } | ||
| 2326 | 806 | tempheader.author[sizeof(tempheader.author)-1] = 0; | |
| 2327 | |||
| 2328 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_getc(&tempheader.use_keyfile,f)) |
| 2329 | { | ||
| 2330 | ✗ | return qe_invalid; | |
| 2331 | } | ||
| 2332 | |||
| 2333 | /* | ||
| 2334 | if(!pfread(tempheader.data_flags,sizeof(tempheader.data_flags),f)) | ||
| 2335 | { | ||
| 2336 | return qe_invalid; | ||
| 2337 | } | ||
| 2338 | */ | ||
| 2339 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_getc(&tempheader.data_flags[ZQ_TILES],f)) |
| 2340 | { | ||
| 2341 | ✗ | return qe_invalid; | |
| 2342 | } | ||
| 2343 | |||
| 2344 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!pfread(&dummybuf,4,f)) |
| 2345 | { | ||
| 2346 | ✗ | return qe_invalid; | |
| 2347 | } | ||
| 2348 | |||
| 2349 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_getc(&tempheader.data_flags[ZQ_CHEATS2],f)) |
| 2350 | { | ||
| 2351 | ✗ | return qe_invalid; | |
| 2352 | } | ||
| 2353 | |||
| 2354 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!pfread(dummybuf,14,f)) |
| 2355 | { | ||
| 2356 | ✗ | return qe_invalid; | |
| 2357 | } | ||
| 2358 | |||
| 2359 | 806 | templatepath_len=sizeof(tempheader.templatepath); | |
| 2360 | |||
| 2361 |
2/2✓ Branch 0 taken 748 times.
✓ Branch 1 taken 58 times.
|
806 | if(version==1) |
| 2362 | { | ||
| 2363 | 58 | templatepath_len=280; | |
| 2364 | 58 | } | |
| 2365 | |||
| 2366 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!pfread(tempheader.templatepath,templatepath_len,f)) |
| 2367 | { | ||
| 2368 | ✗ | return qe_invalid; | |
| 2369 | } | ||
| 2370 | |||
| 2371 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_getc(&temp_map_count,f)) |
| 2372 | { | ||
| 2373 | ✗ | return qe_invalid; | |
| 2374 | } | ||
| 2375 | |||
| 2376 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 591 times.
|
806 | if(version>=4) |
| 2377 | { | ||
| 2378 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&tempheader.version_major,f)) |
| 2379 | { | ||
| 2380 | ✗ | return qe_invalid; | |
| 2381 | } | ||
| 2382 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&tempheader.version_minor,f)) |
| 2383 | { | ||
| 2384 | ✗ | return qe_invalid; | |
| 2385 | } | ||
| 2386 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&tempheader.version_patch,f)) |
| 2387 | { | ||
| 2388 | ✗ | return qe_invalid; | |
| 2389 | } | ||
| 2390 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&tempheader.new_version_id_fourth,f)) |
| 2391 | { | ||
| 2392 | ✗ | return qe_invalid; | |
| 2393 | } | ||
| 2394 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&tempheader.new_version_id_alpha,f)) |
| 2395 | { | ||
| 2396 | ✗ | return qe_invalid; | |
| 2397 | } | ||
| 2398 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&tempheader.new_version_id_beta,f)) |
| 2399 | { | ||
| 2400 | ✗ | return qe_invalid; | |
| 2401 | } | ||
| 2402 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&tempheader.new_version_id_gamma,f)) |
| 2403 | { | ||
| 2404 | ✗ | return qe_invalid; | |
| 2405 | } | ||
| 2406 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&tempheader.new_version_id_release,f)) |
| 2407 | { | ||
| 2408 | ✗ | return qe_invalid; | |
| 2409 | } | ||
| 2410 | |||
| 2411 | // 2.55 alpha 86 incorrectly used 56 as the second version component. Fix that here. | ||
| 2412 |
3/6✓ Branch 0 taken 45 times.
✓ Branch 1 taken 170 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 45 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
215 | if (tempheader.version_major == 2 && tempheader.version_minor == 56 && tempheader.new_version_id_alpha == 86) |
| 2413 | ✗ | tempheader.version_minor = 55; | |
| 2414 | |||
| 2415 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetw(&tempheader.new_version_id_date_year,f)) |
| 2416 | { | ||
| 2417 | ✗ | return qe_invalid; | |
| 2418 | } | ||
| 2419 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_getc(&tempheader.new_version_id_date_month,f)) |
| 2420 | { | ||
| 2421 | ✗ | return qe_invalid; | |
| 2422 | } | ||
| 2423 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_getc(&tempheader.new_version_id_date_day,f)) |
| 2424 | { | ||
| 2425 | ✗ | return qe_invalid; | |
| 2426 | } | ||
| 2427 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_getc(&tempheader.new_version_id_date_hour,f)) |
| 2428 | { | ||
| 2429 | ✗ | return qe_invalid; | |
| 2430 | } | ||
| 2431 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_getc(&tempheader.new_version_id_date_minute,f)) |
| 2432 | { | ||
| 2433 | ✗ | return qe_invalid; | |
| 2434 | } | ||
| 2435 | |||
| 2436 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!pfread(tempheader.new_version_devsig,256,f)) |
| 2437 | { | ||
| 2438 | ✗ | return qe_invalid; | |
| 2439 | } | ||
| 2440 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if(!strcmp(tempheader.new_version_devsig, "Venrob")) |
| 2441 | ✗ | strcpy(tempheader.new_version_devsig, "EmilyV99"); | |
| 2442 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!pfread(tempheader.new_version_compilername,256,f)) |
| 2443 | { | ||
| 2444 | ✗ | return qe_invalid; | |
| 2445 | } | ||
| 2446 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!pfread(tempheader.new_version_compilerversion,256,f)) |
| 2447 | { | ||
| 2448 | ✗ | return qe_invalid; | |
| 2449 | } | ||
| 2450 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!pfread(tempheader.product_name,1024,f)) |
| 2451 | { | ||
| 2452 | ✗ | return qe_invalid; | |
| 2453 | } | ||
| 2454 | |||
| 2455 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_getc(&tempheader.compilerid,f)) |
| 2456 | { | ||
| 2457 | ✗ | return qe_invalid; | |
| 2458 | } | ||
| 2459 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&tempheader.compilerversionnumber_first,f)) |
| 2460 | { | ||
| 2461 | ✗ | return qe_invalid; | |
| 2462 | } | ||
| 2463 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&tempheader.compilerversionnumber_second,f)) |
| 2464 | { | ||
| 2465 | ✗ | return qe_invalid; | |
| 2466 | } | ||
| 2467 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&tempheader.compilerversionnumber_third,f)) |
| 2468 | { | ||
| 2469 | ✗ | return qe_invalid; | |
| 2470 | } | ||
| 2471 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&tempheader.compilerversionnumber_fourth,f)) |
| 2472 | { | ||
| 2473 | ✗ | return qe_invalid; | |
| 2474 | } | ||
| 2475 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetw(&tempheader.developerid,f)) |
| 2476 | { | ||
| 2477 | ✗ | return qe_invalid; | |
| 2478 | } | ||
| 2479 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!pfread(tempheader.made_in_module_name,1024,f)) |
| 2480 | { | ||
| 2481 | ✗ | return qe_invalid; | |
| 2482 | } | ||
| 2483 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!pfread(tempheader.build_datestamp,256,f)) |
| 2484 | { | ||
| 2485 | ✗ | return qe_invalid; | |
| 2486 | } | ||
| 2487 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!pfread(tempheader.build_timestamp,256,f)) |
| 2488 | { | ||
| 2489 | ✗ | return qe_invalid; | |
| 2490 | } | ||
| 2491 | 215 | } | |
| 2492 | else // <4 | ||
| 2493 | { | ||
| 2494 | 591 | tempheader.version_major = 0; | |
| 2495 | 591 | tempheader.version_minor = 0; | |
| 2496 | 591 | tempheader.version_patch = 0; | |
| 2497 | 591 | tempheader.new_version_id_fourth = 0; | |
| 2498 | 591 | tempheader.new_version_id_alpha = 0; | |
| 2499 | 591 | tempheader.new_version_id_beta = 0; | |
| 2500 | 591 | tempheader.new_version_id_gamma = 0; | |
| 2501 | 591 | tempheader.new_version_id_release = 0; | |
| 2502 | 591 | tempheader.new_version_id_date_year = 0; | |
| 2503 | 591 | tempheader.new_version_id_date_month = 0; | |
| 2504 | 591 | tempheader.new_version_id_date_day = 0; | |
| 2505 | 591 | tempheader.new_version_id_date_hour = 0; | |
| 2506 | 591 | tempheader.new_version_id_date_minute = 0; | |
| 2507 | |||
| 2508 | 591 | memset(tempheader.new_version_devsig, 0, 256); | |
| 2509 | 591 | memset(tempheader.new_version_compilername, 0, 256); | |
| 2510 | 591 | memset(tempheader.new_version_compilerversion, 0, 256); | |
| 2511 | 591 | memset(tempheader.product_name, 0, 1024); | |
| 2512 | 591 | strcpy(tempheader.product_name, "ZQuest Classic"); | |
| 2513 | |||
| 2514 | 591 | tempheader.compilerid = 0; | |
| 2515 | 591 | tempheader.compilerversionnumber_first = 0; | |
| 2516 | 591 | tempheader.compilerversionnumber_second = 0; | |
| 2517 | 591 | tempheader.compilerversionnumber_third = 0; | |
| 2518 | 591 | tempheader.compilerversionnumber_fourth = 0; | |
| 2519 | 591 | tempheader.developerid = 0; | |
| 2520 | |||
| 2521 | 591 | memset(tempheader.made_in_module_name, 0, 1024); | |
| 2522 | 591 | memset(tempheader.build_datestamp, 0, 256); | |
| 2523 | 591 | memset(tempheader.build_timestamp, 0, 256); | |
| 2524 | } | ||
| 2525 | |||
| 2526 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 591 times.
|
806 | if ( version >= 5 ) |
| 2527 | { | ||
| 2528 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!pfread(tempheader.build_timezone,6,f)) |
| 2529 | { | ||
| 2530 | ✗ | return qe_invalid; | |
| 2531 | } | ||
| 2532 | 215 | } | |
| 2533 | else // < 5 | ||
| 2534 | { | ||
| 2535 | 591 | memset(tempheader.build_timezone, 0, 6); | |
| 2536 | } | ||
| 2537 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 591 times.
|
806 | if ( version >= 6 ) |
| 2538 | { | ||
| 2539 | byte b; | ||
| 2540 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_getc(&b,f)) |
| 2541 | { | ||
| 2542 | ✗ | return qe_invalid; | |
| 2543 | } | ||
| 2544 | 215 | tempheader.external_zinfo = b?true:false; | |
| 2545 | 215 | read_zinfo = true; | |
| 2546 | 215 | } | |
| 2547 | |||
| 2548 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 591 times.
|
806 | if(version >= 7) |
| 2549 | { | ||
| 2550 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_getc(&(tempheader.new_version_is_nightly),f)) |
| 2551 | { | ||
| 2552 | ✗ | return qe_invalid; | |
| 2553 | } | ||
| 2554 | 215 | } | |
| 2555 | else | ||
| 2556 | { | ||
| 2557 | 591 | tempheader.new_version_is_nightly = false; | |
| 2558 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 591 times.
|
591 | if(tempheader.zelda_version < 0x255) |
| 2559 | { | ||
| 2560 |
2/5✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 533 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 58 times.
|
591 | switch(tempheader.zelda_version) |
| 2561 | { | ||
| 2562 | case 0x254: | ||
| 2563 | ✗ | tempheader.version_major = 2; | |
| 2564 | ✗ | tempheader.version_minor = 54; | |
| 2565 | ✗ | break; | |
| 2566 | case 0x250: | ||
| 2567 |
7/16✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 31 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 24 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 6 times.
✓ Branch 11 taken 414 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 16 times.
✓ Branch 14 taken 29 times.
✓ Branch 15 taken 13 times.
|
533 | switch(tempheader.build) |
| 2568 | { | ||
| 2569 | case 19: | ||
| 2570 | ✗ | tempheader.version_major = 2; | |
| 2571 | ✗ | tempheader.version_minor = 50; | |
| 2572 | ✗ | tempheader.new_version_id_gamma = 1; | |
| 2573 | ✗ | break; | |
| 2574 | case 20: | ||
| 2575 | ✗ | tempheader.version_major = 2; | |
| 2576 | ✗ | tempheader.version_minor = 50; | |
| 2577 | ✗ | tempheader.new_version_id_gamma = 2; | |
| 2578 | ✗ | break; | |
| 2579 | case 21: | ||
| 2580 | ✗ | tempheader.version_major = 2; | |
| 2581 | ✗ | tempheader.version_minor = 50; | |
| 2582 | ✗ | tempheader.new_version_id_gamma = 3; | |
| 2583 | ✗ | break; | |
| 2584 | case 22: | ||
| 2585 | ✗ | tempheader.version_major = 2; | |
| 2586 | ✗ | tempheader.version_minor = 50; | |
| 2587 | ✗ | tempheader.new_version_id_gamma = 4; | |
| 2588 | ✗ | break; | |
| 2589 | case 23: | ||
| 2590 | ✗ | tempheader.version_major = 2; | |
| 2591 | ✗ | tempheader.version_minor = 50; | |
| 2592 | ✗ | tempheader.new_version_id_gamma = 5; | |
| 2593 | ✗ | break; | |
| 2594 | case 24: | ||
| 2595 | 31 | tempheader.version_major = 2; | |
| 2596 | 31 | tempheader.version_minor = 50; | |
| 2597 | 31 | tempheader.new_version_id_release = -1; | |
| 2598 | 31 | break; | |
| 2599 | case 25: | ||
| 2600 | ✗ | tempheader.version_major = 2; | |
| 2601 | ✗ | tempheader.version_minor = 50; | |
| 2602 | ✗ | tempheader.version_patch = 1; | |
| 2603 | ✗ | tempheader.new_version_id_gamma = 1; | |
| 2604 | ✗ | break; | |
| 2605 | case 26: | ||
| 2606 | 24 | tempheader.version_major = 2; | |
| 2607 | 24 | tempheader.version_minor = 50; | |
| 2608 | 24 | tempheader.version_patch = 1; | |
| 2609 | 24 | tempheader.new_version_id_gamma = 2; | |
| 2610 | 24 | break; | |
| 2611 | case 27: | ||
| 2612 | ✗ | tempheader.version_major = 2; | |
| 2613 | ✗ | tempheader.version_minor = 50; | |
| 2614 | ✗ | tempheader.version_patch = 1; | |
| 2615 | ✗ | tempheader.new_version_id_gamma = 3; | |
| 2616 | ✗ | break; | |
| 2617 | case 28: | ||
| 2618 | 6 | tempheader.version_major = 2; | |
| 2619 | 6 | tempheader.version_minor = 50; | |
| 2620 | 6 | tempheader.version_patch = 1; | |
| 2621 | 6 | tempheader.new_version_id_release = -1; | |
| 2622 | 6 | break; | |
| 2623 | case 29: | ||
| 2624 | 414 | tempheader.version_major = 2; | |
| 2625 | 414 | tempheader.version_minor = 50; | |
| 2626 | 414 | tempheader.version_patch = 2; | |
| 2627 | 414 | tempheader.new_version_id_release = -1; | |
| 2628 | 414 | break; | |
| 2629 | case 30: | ||
| 2630 | ✗ | tempheader.version_major = 2; | |
| 2631 | ✗ | tempheader.version_minor = 50; | |
| 2632 | ✗ | tempheader.version_patch = 3; | |
| 2633 | ✗ | tempheader.new_version_id_gamma = 1; | |
| 2634 | ✗ | break; | |
| 2635 | case 31: | ||
| 2636 | 16 | tempheader.version_major = 2; | |
| 2637 | 16 | tempheader.version_minor = 53; | |
| 2638 | 16 | tempheader.new_version_id_gamma = -1; | |
| 2639 | 16 | break; | |
| 2640 | case 32: | ||
| 2641 | 29 | tempheader.version_major = 2; | |
| 2642 | 29 | tempheader.version_minor = 53; | |
| 2643 | 29 | tempheader.new_version_id_release = -1; | |
| 2644 | 29 | break; | |
| 2645 | case 33: | ||
| 2646 | 13 | tempheader.version_major = 2; | |
| 2647 | 13 | tempheader.version_minor = 53; | |
| 2648 | 13 | tempheader.version_patch = 1; | |
| 2649 | 13 | break; | |
| 2650 | } | ||
| 2651 | 533 | break; | |
| 2652 | |||
| 2653 | case 0x211: | ||
| 2654 | ✗ | tempheader.version_major = 2; | |
| 2655 | ✗ | tempheader.version_minor = 11; | |
| 2656 | ✗ | tempheader.new_version_id_beta = tempheader.build; | |
| 2657 | ✗ | break; | |
| 2658 | case 0x210: | ||
| 2659 | 58 | tempheader.version_major = 2; | |
| 2660 | 58 | tempheader.version_minor = 10; | |
| 2661 | 58 | tempheader.new_version_id_beta = tempheader.build; | |
| 2662 | 58 | break; | |
| 2663 | } | ||
| 2664 | 591 | } | |
| 2665 | } | ||
| 2666 | |||
| 2667 |
2/2✓ Branch 0 taken 170 times.
✓ Branch 1 taken 636 times.
|
806 | if (version>=9) |
| 2668 | { | ||
| 2669 | 170 | std::string version_string; | |
| 2670 |
2/4✓ Branch 0 taken 170 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 170 times.
✗ Branch 3 not taken.
|
170 | if(!p_getcstr(&version_string, f)) |
| 2671 | { | ||
| 2672 | ✗ | return qe_invalid; | |
| 2673 | } | ||
| 2674 | |||
| 2675 | 170 | strncpy(tempheader.zelda_version_string, version_string.c_str(), sizeof(tempheader.zelda_version_string)); | |
| 2676 | 170 | snprintf(tempheader.zelda_version_string, sizeof(tempheader.zelda_version_string), "%s", version_string.c_str()); | |
| 2677 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 170 times.
|
170 | } |
| 2678 | else | ||
| 2679 | { | ||
| 2680 | 636 | snprintf(tempheader.zelda_version_string, sizeof(tempheader.zelda_version_string), "%d.%d.%d", tempheader.version_major, tempheader.version_minor, tempheader.version_patch); | |
| 2681 | } | ||
| 2682 | } | ||
| 2683 | |||
| 2684 |
2/2✓ Branch 0 taken 58 times.
✓ Branch 1 taken 772 times.
|
830 | if(printmetadata) |
| 2685 | { | ||
| 2686 |
1/2✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
|
58 | print_quest_metadata(tempheader, loading_qst_name, loading_qst_num); |
| 2687 | 58 | } | |
| 2688 | |||
| 2689 | //{ Version Warning | ||
| 2690 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | int32_t vercmp = tempheader.compareVer(); |
| 2691 |
3/6✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 830 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 830 times.
✗ Branch 5 not taken.
|
830 | int32_t astatecmp = compare(int32_t(tempheader.getAlphaState()), getAlphaState()); |
| 2692 |
2/4✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 830 times.
✗ Branch 3 not taken.
|
830 | int32_t avercmp = compare(tempheader.getAlphaVer(), 0); |
| 2693 |
4/6✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 170 times.
✓ Branch 3 taken 660 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 170 times.
|
1000 | if(vercmp > 0 || (!vercmp && |
| 2694 |
2/4✓ Branch 0 taken 170 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 170 times.
✗ Branch 3 not taken.
|
170 | (astatecmp > 0 || (!astatecmp && |
| 2695 | 170 | avercmp > 0)))) | |
| 2696 | { | ||
| 2697 | ✗ | bool r = true; | |
| 2698 | ✗ | if(loadquest_report) | |
| 2699 | { | ||
| 2700 | ✗ | enter_sys_pal(); | |
| 2701 | ✗ | r = alert_confirm("Quest saved in newer version", | |
| 2702 | "This quest was last saved in a newer version of ZQuest." | ||
| 2703 | " Attempting to load this quest may not work correctly; to" | ||
| 2704 | ✗ | " avoid issues, try loading this quest in at least '" + std::string(tempheader.getVerStr()) + "'" | |
| 2705 | "\n\nWould you like to continue loading anyway? (Not recommended)"); | ||
| 2706 | ✗ | exit_sys_pal(); | |
| 2707 | ✗ | } | |
| 2708 | ✗ | if(!r) | |
| 2709 | ✗ | return qe_silenterr; | |
| 2710 | ✗ | } | |
| 2711 | //} | ||
| 2712 | |||
| 2713 | 830 | read_ext_zinfo = tempheader.external_zinfo; | |
| 2714 | |||
| 2715 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | *Header = tempheader; |
| 2716 | 830 | map_count=temp_map_count; | |
| 2717 | 830 | memcpy(midi_flags, temp_midi_flags, MIDIFLAGS_SIZE); | |
| 2718 | |||
| 2719 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | unpack_qrs(); |
| 2720 | |||
| 2721 | 830 | return 0; | |
| 2722 | 854 | } | |
| 2723 | |||
| 2724 | 11578 | int32_t readrules(PACKFILE *f, zquestheader *Header) | |
| 2725 | { | ||
| 2726 |
2/2✓ Branch 0 taken 11555 times.
✓ Branch 1 taken 23 times.
|
11578 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_rules); |
| 2727 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11578 times.
|
11578 | if (should_skip) |
| 2728 | ✗ | return 0; | |
| 2729 | |||
| 2730 | int32_t dummy; | ||
| 2731 | 11578 | zquestheader tempheader = *Header; | |
| 2732 | 11578 | word s_version=0; | |
| 2733 | 11578 | dword compatrule_version=0; | |
| 2734 | |||
| 2735 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 11105 times.
|
11578 | if(tempheader.zelda_version >= 0x193) |
| 2736 | { | ||
| 2737 | //section version info | ||
| 2738 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 473 times.
✗ Branch 3 not taken.
|
473 | if(!p_igetw(&s_version,f)) |
| 2739 | { | ||
| 2740 | ✗ | return qe_invalid; | |
| 2741 | } | ||
| 2742 | |||
| 2743 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if (s_version > V_RULES) |
| 2744 | ✗ | return qe_version; | |
| 2745 | |||
| 2746 | 473 | FFCore.quest_format[vRules] = s_version; | |
| 2747 | |||
| 2748 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 473 times.
✗ Branch 3 not taken.
|
473 | if(!p_igetw(&dummy,f)) |
| 2749 | { | ||
| 2750 | ✗ | return qe_invalid; | |
| 2751 | } | ||
| 2752 | |||
| 2753 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 258 times.
|
473 | if(s_version > 16) |
| 2754 | { | ||
| 2755 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&compatrule_version,f)) |
| 2756 | { | ||
| 2757 | ✗ | return qe_invalid; | |
| 2758 | } | ||
| 2759 | 215 | } | |
| 2760 | 473 | FFCore.quest_format[vCompatRule] = compatrule_version; | |
| 2761 | |||
| 2762 | //section size | ||
| 2763 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 473 times.
✗ Branch 3 not taken.
|
473 | if(!p_igetl(&dummy,f)) |
| 2764 | { | ||
| 2765 | ✗ | return qe_invalid; | |
| 2766 | } | ||
| 2767 | |||
| 2768 |
2/2✓ Branch 0 taken 258 times.
✓ Branch 1 taken 215 times.
|
473 | if ( s_version < 15 ) |
| 2769 | { | ||
| 2770 | //finally... section data | ||
| 2771 |
2/4✓ Branch 0 taken 258 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 258 times.
✗ Branch 3 not taken.
|
258 | if(!pfread(quest_rules,QUESTRULES_SIZE,f)) |
| 2772 | { | ||
| 2773 | ✗ | return qe_invalid; | |
| 2774 | } | ||
| 2775 | 258 | } | |
| 2776 | else | ||
| 2777 | { | ||
| 2778 | |||
| 2779 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!pfread(quest_rules,QUESTRULES_NEW_SIZE,f)) |
| 2780 | { | ||
| 2781 | ✗ | return qe_invalid; | |
| 2782 | } | ||
| 2783 | |||
| 2784 | } | ||
| 2785 | 473 | } | |
| 2786 | |||
| 2787 | //{ bunch of compat stuff | ||
| 2788 | 11578 | memcpy(deprecated_rules, quest_rules, QUESTRULES_NEW_SIZE); | |
| 2789 | |||
| 2790 |
2/2✓ Branch 0 taken 496 times.
✓ Branch 1 taken 11082 times.
|
11578 | unpack_qrs(); |
| 2791 | |||
| 2792 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 415 times.
|
496 | if(s_version<2) |
| 2793 | { | ||
| 2794 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(14,0); |
| 2795 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(27,0); |
| 2796 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(28,0); |
| 2797 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(29,0); |
| 2798 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(30,0); |
| 2799 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(32,0); |
| 2800 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(36,0); |
| 2801 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(49,0); |
| 2802 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(50,0); |
| 2803 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(51,0); |
| 2804 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(68,0); |
| 2805 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(75,0); |
| 2806 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(76,0); |
| 2807 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(98,0); |
| 2808 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(110,0); |
| 2809 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(113,0); |
| 2810 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(116,0); |
| 2811 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(102,0); |
| 2812 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(132,0); |
| 2813 | 81 | } | |
| 2814 | |||
| 2815 | //Now, do any updates... | ||
| 2816 |
3/4✓ Branch 0 taken 415 times.
✓ Branch 1 taken 81 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 415 times.
|
496 | if((tempheader.zelda_version < 0x211)||((tempheader.zelda_version == 0x211)&&(tempheader.build<18))) |
| 2817 | { | ||
| 2818 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_SMOOTHVERTICALSCROLLING,1); |
| 2819 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_REPLACEOPENDOORS, 1); |
| 2820 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_OLDLENSORDER, 1); |
| 2821 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_NOFAIRYGUYFIRES, 1); |
| 2822 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_TRIGGERSREPEAT, 1); |
| 2823 | 81 | } | |
| 2824 | |||
| 2825 |
3/4✓ Branch 0 taken 473 times.
✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 473 times.
|
496 | if((tempheader.zelda_version < 0x193)||((tempheader.zelda_version == 0x193)&&(tempheader.build<3))) |
| 2826 | { | ||
| 2827 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | set_qr(qr_WALLFLIERS,1); |
| 2828 | 23 | } | |
| 2829 | |||
| 2830 |
3/4✓ Branch 0 taken 473 times.
✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 473 times.
|
496 | if((tempheader.zelda_version < 0x193)||((tempheader.zelda_version == 0x193)&&(tempheader.build<4))) |
| 2831 | { | ||
| 2832 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | set_qr(qr_NOBOMBPALFLASH,1); |
| 2833 | 23 | } | |
| 2834 | |||
| 2835 |
3/4✓ Branch 0 taken 473 times.
✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 473 times.
|
496 | if((tempheader.zelda_version < 0x193)||((tempheader.zelda_version == 0x193)&&(tempheader.build<3))) |
| 2836 | { | ||
| 2837 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | set_qr(qr_NOSCROLLCONTINUE,1); |
| 2838 | 23 | } | |
| 2839 | |||
| 2840 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 415 times.
|
496 | if(tempheader.zelda_version <= 0x210) |
| 2841 | { | ||
| 2842 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_ARROWCLIP,1); |
| 2843 | 81 | } | |
| 2844 | |||
| 2845 |
2/2✓ Branch 0 taken 58 times.
✓ Branch 1 taken 438 times.
|
496 | if(tempheader.zelda_version == 0x210) |
| 2846 | { | ||
| 2847 |
1/2✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
|
58 | set_qr(qr_NOSCROLLCONTINUE, get_qr(qr_CMBCYCLELAYERS)); |
| 2848 |
1/2✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
|
58 | set_qr(qr_CMBCYCLELAYERS, 0); |
| 2849 |
1/2✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
|
58 | set_qr(qr_CONT_SWORD_TRIGGERS, 1); |
| 2850 | 58 | } | |
| 2851 | |||
| 2852 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 415 times.
|
496 | if(tempheader.zelda_version <= 0x210) |
| 2853 | { | ||
| 2854 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_OLDSTYLEWARP,1); |
| 2855 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_210_WARPRETURN,1); |
| 2856 | 81 | } | |
| 2857 | |||
| 2858 | //might not be correct | ||
| 2859 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 473 times.
|
496 | if(tempheader.zelda_version < 0x210) |
| 2860 | { | ||
| 2861 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | set_bit(deprecated_rules, qr_OLDTRIBBLES_DEP,1); |
| 2862 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | set_qr(qr_OLDTRIBBLES_DEP,1); |
| 2863 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | set_qr(qr_OLDHOOKSHOTGRAB,1); |
| 2864 | 23 | } | |
| 2865 | |||
| 2866 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 415 times.
|
496 | if(tempheader.zelda_version < 0x211) |
| 2867 | { | ||
| 2868 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_WRONG_BRANG_TRAIL_DIR,1); |
| 2869 | 81 | } | |
| 2870 | |||
| 2871 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 491 times.
|
496 | if((tempheader.zelda_version == 0x192 && tempheader.build <= 163) || tempheader.zelda_version < 0x192) |
| 2872 | { | ||
| 2873 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 474 times.
|
496 | set_qr(qr_192b163_WARP,1); |
| 2874 | 22 | } | |
| 2875 | |||
| 2876 |
2/2✓ Branch 0 taken 58 times.
✓ Branch 1 taken 36 times.
|
22 | if(tempheader.zelda_version == 0x210) |
| 2877 | { | ||
| 2878 |
1/2✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
|
58 | set_bit(deprecated_rules, qr_OLDTRIBBLES_DEP, get_qr(qr_DMGCOMBOPRI)); |
| 2879 |
1/2✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
|
58 | set_qr(qr_OLDTRIBBLES_DEP, get_qr(qr_DMGCOMBOPRI)); |
| 2880 |
1/2✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
|
58 | set_qr(qr_DMGCOMBOPRI, 0); |
| 2881 | 58 | } | |
| 2882 | |||
| 2883 |
3/4✓ Branch 0 taken 415 times.
✓ Branch 1 taken 321 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 415 times.
|
94 | if(tempheader.zelda_version < 0x211 || (tempheader.zelda_version == 0x211 && tempheader.build<15)) |
| 2884 | { | ||
| 2885 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 240 times.
|
321 | set_qr(qr_OLDPICKUP,1); |
| 2886 | 81 | } | |
| 2887 | |||
| 2888 |
3/4✓ Branch 0 taken 415 times.
✓ Branch 1 taken 81 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 415 times.
|
496 | if(tempheader.zelda_version < 0x211 || (tempheader.zelda_version == 0x211 && tempheader.build < 18)) |
| 2889 | { | ||
| 2890 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_NOSOLIDDAMAGECOMBOS, 1); |
| 2891 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_ITEMPICKUPSETSBELOW, 1); // broke around build 400 |
| 2892 | 81 | } | |
| 2893 | |||
| 2894 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 415 times.
|
496 | if(tempheader.zelda_version < 0x250) // version<0x250 checks for beta 18; build was set to 18 prematurely |
| 2895 | { | ||
| 2896 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_HOOKSHOTDOWNBUG, 1); |
| 2897 | 81 | } | |
| 2898 | |||
| 2899 |
4/4✓ Branch 0 taken 200 times.
✓ Branch 1 taken 296 times.
✓ Branch 2 taken 31 times.
✓ Branch 3 taken 169 times.
|
496 | if(tempheader.zelda_version == 0x250 && tempheader.build == 24) // Annoying... |
| 2900 | { | ||
| 2901 |
1/2✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
|
31 | set_qr(qr_PEAHATCLOCKVULN, 1); |
| 2902 | 31 | } | |
| 2903 | |||
| 2904 |
4/4✓ Branch 0 taken 415 times.
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 215 times.
|
496 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 22)) //22 is 2.50.0 RC4. Gotta set the door repair QR... -Dimi |
| 2905 | { | ||
| 2906 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 200 times.
|
281 | set_qr(qr_OLD_DOORREPAIR, 1); |
| 2907 | 81 | } | |
| 2908 | |||
| 2909 |
4/4✓ Branch 0 taken 415 times.
✓ Branch 1 taken 119 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 215 times.
|
296 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 20)) //20 is 2.50.0 RC1 and RC2 (cause it didn't get bumped). Okay I'm gonna be honest I have no idea if any 2.50 build was available before RC1, but gonna try and cover my ass here -Dimi |
| 2910 | { | ||
| 2911 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 238 times.
|
319 | set_qr(qr_OLD_SECRETMONEY, 1); |
| 2912 | 81 | } | |
| 2913 | |||
| 2914 |
4/4✓ Branch 0 taken 415 times.
✓ Branch 1 taken 119 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 215 times.
|
296 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 28)) //28 is 2.50.1 final. Potion bug might have been used, I dunno. -Dimi |
| 2915 | { | ||
| 2916 |
2/2✓ Branch 0 taken 136 times.
✓ Branch 1 taken 183 times.
|
319 | set_qr(qr_OLD_POTION_OR_HC, 1); |
| 2917 | 136 | } | |
| 2918 | |||
| 2919 |
4/4✓ Branch 0 taken 415 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 215 times.
|
351 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<28)) |
| 2920 | { | ||
| 2921 |
2/2✓ Branch 0 taken 136 times.
✓ Branch 1 taken 128 times.
|
264 | set_qr(qr_OFFSCREENWEAPONS, 1); |
| 2922 | 136 | } | |
| 2923 | |||
| 2924 | //Bombchu fix. | ||
| 2925 |
2/2✓ Branch 0 taken 153 times.
✓ Branch 1 taken 200 times.
|
351 | if(tempheader.zelda_version == 0x250) |
| 2926 | { | ||
| 2927 |
2/2✓ Branch 0 taken 31 times.
✓ Branch 1 taken 169 times.
|
200 | if ( tempheader.build == 24 ) //2.50.0 |
| 2928 | { | ||
| 2929 |
1/2✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
|
31 | set_qr(qr_BOMBCHUSUPERBOMB, 1); |
| 2930 | 31 | } | |
| 2931 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 194 times.
|
200 | if ( tempheader.build == 28 ) //2.50.1 |
| 2932 | { | ||
| 2933 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | set_qr(qr_BOMBCHUSUPERBOMB, 1); |
| 2934 | 6 | } | |
| 2935 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 119 times.
|
200 | if ( tempheader.build == 29 ) //2.50.2 |
| 2936 | { | ||
| 2937 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_BOMBCHUSUPERBOMB, 0); |
| 2938 | 81 | } | |
| 2939 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if ( tempheader.build == 30 ) //2.50.3RC1 |
| 2940 | { | ||
| 2941 | ✗ | set_qr(qr_BOMBCHUSUPERBOMB, 0); | |
| 2942 | ✗ | } | |
| 2943 | 200 | } | |
| 2944 | |||
| 2945 |
4/4✓ Branch 0 taken 415 times.
✓ Branch 1 taken 62 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 215 times.
|
353 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<29)) |
| 2946 | { | ||
| 2947 | // qr_OFFSETEWPNCOLLISIONFIX | ||
| 2948 | // All 'official' quests need this disabled. | ||
| 2949 | // All 2.10 and lower quests need this enabled to preseve compatability. | ||
| 2950 | // All 2.11 - 2.5.1 quests should have it set also, due to a bug in about half of all the betas. | ||
| 2951 | |||
| 2952 | //~Gleeok | ||
| 2953 |
2/2✓ Branch 0 taken 142 times.
✓ Branch 1 taken 120 times.
|
262 | set_qr(qr_OFFSETEWPNCOLLISIONFIX, 1); //This has to be set!!!! |
| 2954 | |||
| 2955 | // Broke in build 695 | ||
| 2956 |
3/4✓ Branch 0 taken 61 times.
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 61 times.
✗ Branch 3 not taken.
|
142 | if(tempheader.zelda_version>=0x211 && tempheader.build>=18) |
| 2957 |
1/2✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
|
61 | set_qr(qr_BROKENSTATUES, 1); |
| 2958 | 142 | } | |
| 2959 |
11/14✓ Branch 0 taken 121 times.
✓ Branch 1 taken 478 times.
✓ Branch 2 taken 473 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 594 times.
✓ Branch 7 taken 5 times.
✓ Branch 8 taken 594 times.
✓ Branch 9 taken 5 times.
✓ Branch 10 taken 22 times.
✓ Branch 11 taken 577 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
357 | if (tempheader.zelda_version <= 0x190 || (tempheader.zelda_version == 0x192 && std::string(tempheader.title).starts_with("Zelda 3000\0"))) |
| 2960 | { | ||
| 2961 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | set_qr(qr_COPIED_SWIM_SPRITES, 1); |
| 2962 | 22 | } | |
| 2963 |
8/8✓ Branch 0 taken 200 times.
✓ Branch 1 taken 399 times.
✓ Branch 2 taken 309 times.
✓ Branch 3 taken 90 times.
✓ Branch 4 taken 228 times.
✓ Branch 5 taken 81 times.
✓ Branch 6 taken 215 times.
✓ Branch 7 taken 13 times.
|
599 | if ( (tempheader.zelda_version == 0x250 && tempheader.build < 33) || tempheader.zelda_version == 0x254 || tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x255 && tempheader.build < 50) ) |
| 2964 | { | ||
| 2965 |
2/2✓ Branch 0 taken 268 times.
✓ Branch 1 taken 318 times.
|
586 | set_qr(qr_OLD_SLASHNEXT_SECRETS, 1); |
| 2966 | 268 | } | |
| 2967 | |||
| 2968 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 200 times.
|
281 | if ( (tempheader.zelda_version < 0x211) ) //2.10 water and ladder interaction |
| 2969 | { | ||
| 2970 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_OLD_210_WATER, 1); |
| 2971 | 81 | } | |
| 2972 | |||
| 2973 |
4/6✓ Branch 0 taken 215 times.
✓ Branch 1 taken 118 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 215 times.
|
281 | if ( (tempheader.zelda_version < 0x255 ) || (tempheader.zelda_version == 0x255 && tempheader.build < 51 ) ) //2.10 water and ladder interaction |
| 2974 | { | ||
| 2975 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 163 times.
|
118 | set_qr(qr_STEP_IS_FLOAT,0); |
| 2976 | 281 | } | |
| 2977 | |||
| 2978 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 415 times.
|
496 | if ( tempheader.zelda_version < 0x250 ) |
| 2979 | { | ||
| 2980 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_8WAY_SHOT_SFX_DEP, 1); |
| 2981 | 81 | } | |
| 2982 | |||
| 2983 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 415 times.
|
496 | if(s_version < 3) |
| 2984 | { | ||
| 2985 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_HOLDNOSTOPMUSIC, 1); |
| 2986 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_CAVEEXITNOSTOPMUSIC, 1); |
| 2987 | 81 | } | |
| 2988 | |||
| 2989 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 415 times.
|
496 | if(s_version<4) |
| 2990 | { | ||
| 2991 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(10,0); |
| 2992 | 81 | } | |
| 2993 | |||
| 2994 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 415 times.
|
496 | if(s_version<5) |
| 2995 | { | ||
| 2996 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(27,0); |
| 2997 | 81 | } | |
| 2998 | |||
| 2999 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 415 times.
|
496 | if(s_version<6) |
| 3000 | { | ||
| 3001 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(46,0); |
| 3002 | 81 | } | |
| 3003 | |||
| 3004 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 415 times.
|
496 | if(s_version<7) // January 2008 |
| 3005 | { | ||
| 3006 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_HEARTSREQUIREDFIX,0); |
| 3007 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_PUSHBLOCKCSETFIX,1); |
| 3008 | 81 | } | |
| 3009 | |||
| 3010 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 415 times.
|
496 | if(s_version<8) |
| 3011 | { | ||
| 3012 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(12, 0); |
| 3013 | 81 | } | |
| 3014 | else | ||
| 3015 | { | ||
| 3016 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | set_bit(deprecated_rules, 12, 0); |
| 3017 | } | ||
| 3018 | |||
| 3019 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 415 times.
|
496 | if(s_version<9) // October 2008 |
| 3020 | { | ||
| 3021 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_NOROPE2FLASH_DEP,0); |
| 3022 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_NOBUBBLEFLASH_DEP,0); |
| 3023 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_GHINI2BLINK_DEP,0); |
| 3024 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_PHANTOMGHINI2_DEP,0); |
| 3025 | 81 | } | |
| 3026 | |||
| 3027 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 415 times.
|
496 | if(s_version<10) // December 2008 |
| 3028 | { | ||
| 3029 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_NOCLOCKS_DEP,0); |
| 3030 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_ALLOW10RUPEEDROPS_DEP,0); |
| 3031 | 81 | } | |
| 3032 | |||
| 3033 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 415 times.
|
496 | if(s_version<11) // April 2009 |
| 3034 | { | ||
| 3035 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_SLOWENEMYANIM_DEP,0); |
| 3036 | 81 | } | |
| 3037 | |||
| 3038 | // This served no purpose. | ||
| 3039 | // if(s_version<12) // December 2009 | ||
| 3040 | // { | ||
| 3041 | // set_qr(qr_BRKBLSHLDS_DEP,0); | ||
| 3042 | // set_qr(qr_OLDTRIBBLES_DEP,0); | ||
| 3043 | // } | ||
| 3044 | |||
| 3045 | //if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 24)) | ||
| 3046 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 415 times.
|
496 | if(s_version < 13) |
| 3047 | { | ||
| 3048 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_SHOPCHEAT, 1); |
| 3049 | 81 | } | |
| 3050 | |||
| 3051 | // Not entirely sure this is the best place for this... | ||
| 3052 | //2.50.2 bitmap offset fix | ||
| 3053 | 496 | memset(extra_rules, 0, EXTRARULES_SIZE); | |
| 3054 |
4/4✓ Branch 0 taken 415 times.
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 215 times.
|
496 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<29)) |
| 3055 | { | ||
| 3056 |
2/2✓ Branch 0 taken 142 times.
✓ Branch 1 taken 139 times.
|
281 | set_er(er_BITMAPOFFSET, 1); |
| 3057 |
1/2✓ Branch 0 taken 142 times.
✗ Branch 1 not taken.
|
142 | set_qr(qr_BITMAPOFFSETFIX, 1); |
| 3058 | 142 | } | |
| 3059 | //required because quest templates also used this bit, although | ||
| 3060 | //it never did anything, before. -Z | ||
| 3061 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 159 times.
|
357 | if ( tempheader.zelda_version == 0x250 ) |
| 3062 | { | ||
| 3063 |
5/6✓ Branch 0 taken 119 times.
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 119 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 16 times.
✓ Branch 5 taken 103 times.
|
200 | if( tempheader.build == 29 || tempheader.build == 30 || tempheader.build == 31 ) |
| 3064 | { | ||
| 3065 |
1/2✓ Branch 0 taken 97 times.
✗ Branch 1 not taken.
|
97 | set_er(er_BITMAPOFFSET, 0); |
| 3066 |
1/2✓ Branch 0 taken 97 times.
✗ Branch 1 not taken.
|
97 | set_qr(qr_BITMAPOFFSETFIX, 0); |
| 3067 | 97 | } | |
| 3068 | 200 | } | |
| 3069 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 359 times.
|
359 | if ( tempheader.zelda_version == 0x254 ) |
| 3070 | { | ||
| 3071 | ✗ | set_er(er_BITMAPOFFSET, 0); | |
| 3072 | ✗ | set_qr(qr_BITMAPOFFSETFIX, 0); | |
| 3073 | ✗ | } | |
| 3074 |
3/4✓ Branch 0 taken 215 times.
✓ Branch 1 taken 144 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 215 times.
|
359 | if ( tempheader.zelda_version == 0x255 && tempheader.build < 42 ) //QR was added to 255 in this build. |
| 3075 | { | ||
| 3076 | ✗ | set_er(er_BITMAPOFFSET, 0); | |
| 3077 | ✗ | set_qr(qr_BITMAPOFFSETFIX, 0); | |
| 3078 | ✗ | } | |
| 3079 | //optimise fast drawing for older versions. | ||
| 3080 |
3/4✓ Branch 0 taken 215 times.
✓ Branch 1 taken 144 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
359 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 42) ) |
| 3081 | { | ||
| 3082 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 118 times.
|
359 | set_qr(qr_OLDSPRITEDRAWS, 1); |
| 3083 | 281 | } | |
| 3084 | //Old eweapon->Parent (was added in 2.54, Alpha 19) | ||
| 3085 | //The change was made in build 43, but I'm setting this to < 42, because quests made in 42 would benefit from this change, and | ||
| 3086 | //older quests can set the rule by hand. We need a new qst.dat again. | ||
| 3087 |
4/4✓ Branch 0 taken 496 times.
✓ Branch 1 taken 215 times.
✓ Branch 2 taken 215 times.
✓ Branch 3 taken 281 times.
|
281 | if ( tempheader.zelda_version == 0x254 || (tempheader.zelda_version == 0x255 && tempheader.build < 42) ) |
| 3088 | { | ||
| 3089 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 430 times.
|
430 | set_qr(qr_OLDEWPNPARENT, 1); |
| 3090 | ✗ | } | |
| 3091 |
4/4✓ Branch 0 taken 496 times.
✓ Branch 1 taken 215 times.
✓ Branch 2 taken 215 times.
✓ Branch 3 taken 281 times.
|
281 | if ( tempheader.zelda_version == 0x254 || (tempheader.zelda_version == 0x255 && tempheader.build < 44) ) |
| 3092 | { | ||
| 3093 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 430 times.
|
430 | set_qr(qr_OLDCREATEBITMAP_ARGS, 1); |
| 3094 | ✗ | } | |
| 3095 |
4/4✓ Branch 0 taken 496 times.
✓ Branch 1 taken 215 times.
✓ Branch 2 taken 215 times.
✓ Branch 3 taken 281 times.
|
281 | if ( tempheader.zelda_version == 0x254 || (tempheader.zelda_version == 0x255 && tempheader.build < 45) ) |
| 3096 | { | ||
| 3097 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 430 times.
|
430 | set_qr(qr_OLDQUESTMISC, 1); |
| 3098 | ✗ | } | |
| 3099 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if ( tempheader.zelda_version < 0x254 ) |
| 3100 | { | ||
| 3101 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_OLDCREATEBITMAP_ARGS, 0); |
| 3102 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_OLDEWPNPARENT, 0); |
| 3103 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_OLDQUESTMISC, 0); |
| 3104 | 281 | } | |
| 3105 | |||
| 3106 | //item scripts continue to run | ||
| 3107 |
3/4✓ Branch 0 taken 215 times.
✓ Branch 1 taken 118 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
281 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 44) ) |
| 3108 | { | ||
| 3109 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 52 times.
|
333 | set_qr(qr_ITEMSCRIPTSKEEPRUNNING, 0); |
| 3110 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_SCRIPTSRUNINHEROSTEPFORWARD, 0); |
| 3111 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_FIXSCRIPTSDURINGSCROLLING, 0); |
| 3112 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_SCRIPTDRAWSINWARPS, 0); |
| 3113 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_DYINGENEMYESDONTHURTHERO, 0); |
| 3114 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_OUTOFBOUNDSENEMIES, 0); |
| 3115 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_SPRITEXY_IS_FLOAT, 0); |
| 3116 | 281 | } | |
| 3117 | |||
| 3118 |
3/4✓ Branch 0 taken 215 times.
✓ Branch 1 taken 118 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
281 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 46) ) |
| 3119 | { | ||
| 3120 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 52 times.
|
333 | set_qr(qr_CLEARINITDONSCRIPTCHANGE, 1); |
| 3121 | 281 | } | |
| 3122 |
3/4✓ Branch 0 taken 215 times.
✓ Branch 1 taken 118 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
281 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 46) ) |
| 3123 | { | ||
| 3124 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 52 times.
|
333 | set_qr(qr_TRACESCRIPTIDS, 0); |
| 3125 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_SCRIPT_FRIENDLY_ENEMY_TYPES, 1); |
| 3126 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_PARSER_BOOL_TRUE_DECIMAL, 1); |
| 3127 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_PARSER_250DIVISION,1); |
| 3128 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_PARSER_BOOL_TRUE_DECIMAL,1); |
| 3129 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_PARSER_TRUE_INT_SIZE,0); |
| 3130 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_PARSER_FORCE_INLINE,0); |
| 3131 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_PARSER_BINARY_32BIT,0); |
| 3132 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 273 times.
|
281 | if ( get_qr(qr_SELECTAWPN) ) |
| 3133 | { | ||
| 3134 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | set_qr(qr_NO_L_R_BUTTON_INVENTORY_SWAP,1); |
| 3135 | //In < 2.55a27, if you had an A+B subscreen, L and R didn't shift through inventory. | ||
| 3136 | //Now they **do**, unless you disable that behaviour. | ||
| 3137 | //For the sake of compatibility, old quests with the A+B subscreen rule enabed | ||
| 3138 | //now enable the disable L/R item swap on load. | ||
| 3139 | 8 | } | |
| 3140 | |||
| 3141 | 281 | } | |
| 3142 |
3/4✓ Branch 0 taken 215 times.
✓ Branch 1 taken 118 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
281 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 47) ) |
| 3143 | { | ||
| 3144 | //Compatibility: Setting the hero's action to rafting was previously disallowed, though legal for scripts to attempt. | ||
| 3145 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 52 times.
|
333 | set_qr(qr_DISALLOW_SETTING_RAFTING, 1); |
| 3146 | //Compatibility: The calculation for when to loop an animation did not factor in ASkipY correctly, resulting in | ||
| 3147 | //animations ending earlier than they should. | ||
| 3148 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_BROKEN_ASKIP_Y_FRAMES, 1); |
| 3149 | //Enemies would ignore solidity on the top half of combos | ||
| 3150 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_ENEMY_BROKEN_TOP_HALF_SOLIDITY, 1); |
| 3151 | //Ceiling collison was a bit wonky, including hitting your head before you are near the ceiling or clipping into it slightly. | ||
| 3152 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_OLD_SIDEVIEW_CEILING_COLLISON, 1); |
| 3153 | //If an itemdata had a 'frames' of 0, items created of that data would ignore all changes to 'frames' | ||
| 3154 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_0AFRAME_ITEMS_IGNORE_AFRAME_CHANGES, 1); |
| 3155 | //Collision used some odd calculations before, and enemies could not be hit back into the top row or left column | ||
| 3156 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_OLD_ENEMY_KNOCKBACK_COLLISION, 1); |
| 3157 | 281 | } | |
| 3158 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if ( tempheader.zelda_version < 0x255 ) |
| 3159 | { | ||
| 3160 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_NOFFCWAITDRAW, 1); |
| 3161 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_NOITEMWAITDRAW, 1); |
| 3162 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_SETENEMYWEAPONSPRITESONWPNCHANGE, 1); |
| 3163 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_OLD_INIT_SCRIPT_TIMING, 1); |
| 3164 | //set_qr(qr_DO_NOT_DEALLOCATE_INIT_AND_SAVELOAD_ARRAYS, 1); | ||
| 3165 | 281 | } | |
| 3166 |
3/4✓ Branch 0 taken 215 times.
✓ Branch 1 taken 118 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
281 | if ( tempheader.zelda_version < 0x255 || ( tempheader.zelda_version == 0x255 && tempheader.build < 48 ) ) |
| 3167 | { | ||
| 3168 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 52 times.
|
333 | set_qr(qr_SETENEMYWEAPONSPRITESONWPNCHANGE, 1); |
| 3169 | 281 | } | |
| 3170 |
3/4✓ Branch 0 taken 215 times.
✓ Branch 1 taken 118 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
281 | if( tempheader.zelda_version < 0x255 || ( tempheader.zelda_version == 0x255 && tempheader.build < 52 ) ) |
| 3171 | { | ||
| 3172 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 52 times.
|
333 | set_qr(qr_OLD_PRINTF_ARGS, 1); |
| 3173 | 281 | } | |
| 3174 | |||
| 3175 | |||
| 3176 |
3/4✓ Branch 0 taken 215 times.
✓ Branch 1 taken 118 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
281 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 54) ) |
| 3177 | { | ||
| 3178 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 52 times.
|
333 | set_qr(qr_BROKEN_RING_POWER, 1); |
| 3179 | 281 | } | |
| 3180 |
3/4✓ Branch 0 taken 215 times.
✓ Branch 1 taken 118 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
281 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 56) ) |
| 3181 | { | ||
| 3182 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 52 times.
|
333 | set_qr(qr_NO_OVERWORLD_MAP_CHARTING, 1); |
| 3183 | 281 | } | |
| 3184 |
5/6✓ Branch 0 taken 215 times.
✓ Branch 1 taken 118 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 163 times.
✓ Branch 5 taken 52 times.
|
281 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 57) ) |
| 3185 | { | ||
| 3186 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_DUNGEONS_USE_CLASSIC_CHARTING, 1); |
| 3187 | 281 | } | |
| 3188 |
3/4✓ Branch 0 taken 215 times.
✓ Branch 1 taken 118 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
333 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 58) ) |
| 3189 | { | ||
| 3190 | //Rule used to be 'qr_SETXYBUTTONITEMS', now split. | ||
| 3191 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 281 times.
|
333 | if(get_qr(qr_SET_XBUTTON_ITEMS)) |
| 3192 | ✗ | set_qr(qr_SET_YBUTTON_ITEMS,1); | |
| 3193 | 281 | } | |
| 3194 |
3/4✓ Branch 0 taken 215 times.
✓ Branch 1 taken 118 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
281 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 59) ) |
| 3195 | { | ||
| 3196 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 52 times.
|
333 | set_qr(qr_ALLOW_EDITING_COMBO_0,1); |
| 3197 | 281 | } | |
| 3198 |
3/4✓ Branch 0 taken 215 times.
✓ Branch 1 taken 118 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
281 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 60) ) |
| 3199 | { | ||
| 3200 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 52 times.
|
333 | set_qr(qr_OLD_CHEST_COLLISION,1); |
| 3201 | 281 | } | |
| 3202 | |||
| 3203 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if ( tempheader.zelda_version < 0x254 ) |
| 3204 | { | ||
| 3205 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_250WRITEEDEFSCRIPT, 1); |
| 3206 | 281 | } | |
| 3207 | //Sideview spikes in 2.50.0 | ||
| 3208 |
4/4✓ Branch 0 taken 415 times.
✓ Branch 1 taken 134 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 215 times.
|
281 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<27)) //2.50.1RC3 |
| 3209 | { | ||
| 3210 |
2/2✓ Branch 0 taken 136 times.
✓ Branch 1 taken 198 times.
|
334 | set_qr(qr_OLDSIDEVIEWSPIKES, 1); |
| 3211 | 136 | } | |
| 3212 | //more 2.50 fixes -Z | ||
| 3213 |
4/4✓ Branch 0 taken 415 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 215 times.
|
351 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<31)) |
| 3214 | { | ||
| 3215 |
2/2✓ Branch 0 taken 223 times.
✓ Branch 1 taken 71 times.
|
264 | set_qr(qr_MELEEMAGICCOST, 0); |
| 3216 |
1/2✓ Branch 0 taken 223 times.
✗ Branch 1 not taken.
|
223 | set_qr(qr_GANONINTRO, 0); //This will get flipped later on in the compatrule 11 check. That's why it's turning it off. |
| 3217 |
1/2✓ Branch 0 taken 223 times.
✗ Branch 1 not taken.
|
223 | set_qr(qr_OLDMIRRORCOMBOS, 1); |
| 3218 |
1/2✓ Branch 0 taken 223 times.
✗ Branch 1 not taken.
|
223 | set_qr(qr_BROKENBOOKCOST, 1); |
| 3219 |
1/2✓ Branch 0 taken 223 times.
✗ Branch 1 not taken.
|
223 | set_qr(qr_BROKENCHARINTDRAWING, 1); |
| 3220 | |||
| 3221 | 223 | } | |
| 3222 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 438 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
438 | if(tempheader.zelda_version == 0x254 && tempheader.build<41) |
| 3223 | { | ||
| 3224 | //set_qr(qr_MELEEMAGICCOST, get_er(er_MAGICCOSTSWORD)); | ||
| 3225 | ✗ | set_qr(qr_MELEEMAGICCOST, 1); | |
| 3226 | ✗ | } | |
| 3227 | |||
| 3228 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 415 times.
|
438 | if(tempheader.zelda_version < 0x193) |
| 3229 | { | ||
| 3230 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | set_qr(qr_SHORTDGNWALK, 1); |
| 3231 | 23 | } | |
| 3232 | |||
| 3233 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 157 times.
|
438 | if(tempheader.zelda_version < 0x255) |
| 3234 | { | ||
| 3235 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_OLDINFMAGIC, 1); |
| 3236 | 281 | } | |
| 3237 | |||
| 3238 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 357 times.
|
438 | if((tempheader.zelda_version < 0x250)) //2.10 and earlier allowed the triforce to Warp Hero out of Item Cellars in Dungeons. -Z (15th March, 2019 ) |
| 3239 | { | ||
| 3240 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_SIDEVIEWTRIFORCECELLAR,1); |
| 3241 | 81 | } | |
| 3242 | |||
| 3243 |
3/4✓ Branch 0 taken 215 times.
✓ Branch 1 taken 223 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
438 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 47) ) |
| 3244 | { | ||
| 3245 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 157 times.
|
438 | set_qr(qr_OLD_F6,1); |
| 3246 | 281 | } | |
| 3247 |
3/4✓ Branch 0 taken 215 times.
✓ Branch 1 taken 118 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
281 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 49) ) |
| 3248 | { | ||
| 3249 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 52 times.
|
333 | set_qr(qr_NO_OVERWRITING_HOPPING,1); |
| 3250 | 281 | } | |
| 3251 |
3/4✓ Branch 0 taken 215 times.
✓ Branch 1 taken 118 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
281 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 50) ) |
| 3252 | { | ||
| 3253 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 52 times.
|
333 | set_qr(qr_STRING_FRAME_OLD_WIDTH_HEIGHT,1); |
| 3254 | 281 | } | |
| 3255 |
3/4✓ Branch 0 taken 215 times.
✓ Branch 1 taken 118 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
281 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 53) ) |
| 3256 | { | ||
| 3257 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 52 times.
|
333 | set_qr(qr_BROKEN_OVERWORLD_MINIMAP,1); |
| 3258 | 281 | } | |
| 3259 | //} | ||
| 3260 | |||
| 3261 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 1) //Enemies->Secret only affects flag 16-31 |
| 3262 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_ENEMIES_SECRET_ONLY_16_31,1); |
| 3263 | |||
| 3264 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 2) //Old CSet2 Handling |
| 3265 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_OLDCS2,1); |
| 3266 | |||
| 3267 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 3) //Hardcoded Shadow/Spawn/Death anim frames |
| 3268 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_HARDCODED_ENEMY_ANIMS,1); |
| 3269 | |||
| 3270 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 4) //Hardcoded Shadow/Spawn/Death anim frames |
| 3271 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_OLD_ITEMDATA_SCRIPT_TIMING,1); |
| 3272 | |||
| 3273 |
3/4✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 81 times.
|
281 | if(compatrule_version < 5 && tempheader.zelda_version >= 0x250) //Hardcoded Shadow/Spawn/Death anim frames |
| 3274 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | set_qr(qr_NO_LANMOLA_RINGLEADER,1); |
| 3275 | |||
| 3276 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 6) //Step->Secret (Temp) only affects flag 16-31 |
| 3277 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_STEPTEMP_SECRET_ONLY_16_31,1); |
| 3278 | |||
| 3279 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 7) //'Hit All Triggers->Perm Secret' doesn't trigger temp secrets |
| 3280 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_ALLTRIG_PERMSEC_NO_TEMP,1); |
| 3281 | |||
| 3282 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 8) //Hardcoded LItem/Bomb/Clock/Magic Tile Mods |
| 3283 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_HARDCODED_LITEM_LTMS,1); |
| 3284 | |||
| 3285 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 9) |
| 3286 | { | ||
| 3287 | //Hardcoded BS Patras | ||
| 3288 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_HARDCODED_BS_PATRA,1); |
| 3289 | //Hardcoded Patra Inner Eye offsets | ||
| 3290 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_PATRAS_USE_HARDCODED_OFFSETS,1); |
| 3291 | //Broken 'Big enemy' animation style | ||
| 3292 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_BROKEN_BIG_ENEMY_ANIMATION,1); |
| 3293 | //Broken Attribute 31/32 | ||
| 3294 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_BROKEN_ATTRIBUTE_31_32,1); |
| 3295 | 281 | } | |
| 3296 | |||
| 3297 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 10) //Shared candle use limits |
| 3298 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_CANDLES_SHARED_LIMIT,1); |
| 3299 | |||
| 3300 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 11) //No cross-screen return points |
| 3301 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_OLD_RESPAWN_POINTS,1); |
| 3302 | |||
| 3303 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 12) |
| 3304 | { | ||
| 3305 | //Old fire trail duration | ||
| 3306 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_OLD_FLAMETRAIL_DURATION,1); |
| 3307 | //Old Intro String in Ganon Room Behavior | ||
| 3308 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 281 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
281 | if(get_qr(qr_GANONINTRO)) set_qr(qr_GANONINTRO,0); |
| 3309 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | else set_qr(qr_GANONINTRO,1); |
| 3310 | 281 | } | |
| 3311 | |||
| 3312 |
2/4✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 281 times.
|
281 | if(compatrule_version < 13 && tempheader.zelda_version >= 0x255) //ANone doesn't reset to originaltile |
| 3313 | ✗ | set_qr(qr_ANONE_NOANIM,1); | |
| 3314 | |||
| 3315 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 14) //Old Bridge Combo Behavior |
| 3316 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_OLD_BRIDGE_COMBOS,1); |
| 3317 | |||
| 3318 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 15) //Broken Z3 Animation |
| 3319 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_BROKEN_Z3_ANIMATION,1); |
| 3320 | |||
| 3321 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 16) //Old Enemy Tile Behavior with Animation (None) Enemies |
| 3322 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_OLD_TILE_INITIALIZATION,1); |
| 3323 | |||
| 3324 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 281 times.
|
281 | if(compatrule_version < 17) |
| 3325 | { | ||
| 3326 | //Old Quake/DrawYOffset behavior | ||
| 3327 | //set_qr(qr_OLD_DRAWOFFSET,1); | ||
| 3328 | //I'm leaving this commented cause I doubt it'll break anything and I think the bugfix might be appreciated in older versions. | ||
| 3329 | //On the offchance that it *does* break old quests, fixing it is as simple as uncommenting the set_bit above. | ||
| 3330 | 281 | } | |
| 3331 | |||
| 3332 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 18) |
| 3333 | { | ||
| 3334 | //Broken DrawScreen Derivative Functions | ||
| 3335 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_BROKEN_DRAWSCREEN_FUNCTIONS,1); |
| 3336 | //Scrolling Cancels Charge | ||
| 3337 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_SCROLLING_KILLS_CHARGE,1); |
| 3338 | 281 | } | |
| 3339 | |||
| 3340 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 19) //Broken Enemy Item Carrying with Large Enemies |
| 3341 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_BROKEN_ITEM_CARRYING,1); |
| 3342 | |||
| 3343 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 20) |
| 3344 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_CUSTOMWEAPON_IGNORE_COST,1); |
| 3345 | |||
| 3346 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 21) |
| 3347 | { | ||
| 3348 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_LEEVERS_DONT_OBEY_STUN,1); |
| 3349 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_GANON_CANT_SPAWN_ON_CONTINUE,1); |
| 3350 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_WIZZROBES_DONT_OBEY_STUN,1); |
| 3351 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_OLD_BUG_NET,1); |
| 3352 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_MANHANDLA_BLOCK_SFX,1); |
| 3353 | 281 | } | |
| 3354 | |||
| 3355 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 22) |
| 3356 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_BROKEN_KEEPOLD_FLAG,1); |
| 3357 | |||
| 3358 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 23) |
| 3359 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_OLD_HALF_MAGIC,1); |
| 3360 | |||
| 3361 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 24) |
| 3362 | { | ||
| 3363 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_WARPS_RESTART_DMAPSCRIPT,1); |
| 3364 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_DMAP_0_CONTINUE_BUG,1); |
| 3365 | 281 | } | |
| 3366 | |||
| 3367 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 281 times.
|
281 | if(compatrule_version < 25) |
| 3368 | { | ||
| 3369 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 281 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
281 | if (get_qr(qr_OLD_FAIRY_LIMIT)) set_qr(qr_OLD_FAIRY_LIMIT,0); |
| 3370 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | else set_qr(qr_OLD_FAIRY_LIMIT,1); |
| 3371 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_OLD_SCRIPTED_KNOCKBACK,1); |
| 3372 | 281 | } | |
| 3373 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | if(compatrule_version < 26) |
| 3374 | { | ||
| 3375 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_OLD_KEESE_Z_AXIS,1); |
| 3376 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_POLVIRE_NO_SHADOW,1); |
| 3377 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_SUBSCR_OLD_SELECTOR,1); |
| 3378 | 281 | } | |
| 3379 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 281 times.
|
281 | if(compatrule_version < 27) //Noticed some junk data in the QR array... |
| 3380 | { | ||
| 3381 |
2/2✓ Branch 0 taken 84581 times.
✓ Branch 1 taken 281 times.
|
84862 | for(auto q = qr_POLVIRE_NO_SHADOW+1; q < qr_PARSER_250DIVISION; ++q) |
| 3382 |
1/2✓ Branch 0 taken 84581 times.
✗ Branch 1 not taken.
|
84581 | set_qr(q,0); |
| 3383 |
2/2✓ Branch 0 taken 1686 times.
✓ Branch 1 taken 281 times.
|
1967 | for(auto q = qr_COMBODATA_INITD_MULT_TENK+1; q < qr_MAX; ++q) |
| 3384 |
1/2✓ Branch 0 taken 1686 times.
✗ Branch 1 not taken.
|
1686 | set_qr(q,0); |
| 3385 | //This should nuke any remaining junk data... not sure if it affected anything previous. -Em | ||
| 3386 | 281 | } | |
| 3387 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 5 times.
|
281 | if(compatrule_version < 28) |
| 3388 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_SUBSCR_BACKWARDS_ID_ORDER,1); |
| 3389 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 5 times.
|
291 | if(compatrule_version < 29) |
| 3390 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_OLD_LOCKBLOCK_COLLISION,1); |
| 3391 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 5 times.
|
291 | if(compatrule_version < 30) |
| 3392 | { | ||
| 3393 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_DECO_2_YOFFSET,1); |
| 3394 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_SCREENSTATE_80s_BUG,1); |
| 3395 | 286 | } | |
| 3396 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 5 times.
|
291 | if(compatrule_version < 31) |
| 3397 | { | ||
| 3398 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_GOHMA_UNDAMAGED_BUG,1); |
| 3399 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_FFCPRELOAD_BUGGED_LOAD,1); |
| 3400 | 286 | } | |
| 3401 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 5 times.
|
291 | if(compatrule_version < 32) |
| 3402 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_BROKEN_GETPIXEL_VALUE,1); |
| 3403 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 5 times.
|
291 | if(compatrule_version < 33) |
| 3404 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_NO_LIFT_SPRITE,1); |
| 3405 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 5 times.
|
291 | if(compatrule_version < 34) |
| 3406 | { | ||
| 3407 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_OLD_SIDEVIEW_LANDING_CODE,1); |
| 3408 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_OLD_FFC_SPEED_CAP,1); |
| 3409 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_OLD_FFC_FUNCTIONALITY,1); |
| 3410 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_OLD_WIZZROBE_SUBMERGING,1); |
| 3411 | 286 | } | |
| 3412 |
2/2✓ Branch 0 taken 288 times.
✓ Branch 1 taken 5 times.
|
291 | if(compatrule_version < 35) |
| 3413 | { | ||
| 3414 |
1/2✓ Branch 0 taken 288 times.
✗ Branch 1 not taken.
|
288 | set_qr(qr_ZS_NO_NEG_ARRAY,1); |
| 3415 |
1/2✓ Branch 0 taken 288 times.
✗ Branch 1 not taken.
|
288 | set_qr(qr_BROKEN_INPUT_DOWN_STATE,1); |
| 3416 | 288 | } | |
| 3417 |
2/2✓ Branch 0 taken 288 times.
✓ Branch 1 taken 5 times.
|
293 | if(compatrule_version < 36) |
| 3418 |
1/2✓ Branch 0 taken 288 times.
✗ Branch 1 not taken.
|
288 | set_qr(qr_OLD_SHALLOW_SFX,1); |
| 3419 |
2/2✓ Branch 0 taken 292 times.
✓ Branch 1 taken 5 times.
|
293 | if(compatrule_version < 37) |
| 3420 |
1/2✓ Branch 0 taken 292 times.
✗ Branch 1 not taken.
|
292 | set_qr(qr_SPARKLES_INHERIT_PROPERTIES,1); |
| 3421 |
2/2✓ Branch 0 taken 292 times.
✓ Branch 1 taken 5 times.
|
297 | if(compatrule_version < 38) |
| 3422 |
1/2✓ Branch 0 taken 292 times.
✗ Branch 1 not taken.
|
292 | set_qr(qr_BUGGED_LAYERED_FLAGS,1); |
| 3423 |
2/2✓ Branch 0 taken 292 times.
✓ Branch 1 taken 5 times.
|
297 | if(compatrule_version < 39) |
| 3424 |
1/2✓ Branch 0 taken 292 times.
✗ Branch 1 not taken.
|
292 | set_qr(qr_HARDCODED_FFC_BUSH_DROPS,1); |
| 3425 |
2/2✓ Branch 0 taken 292 times.
✓ Branch 1 taken 5 times.
|
297 | if(compatrule_version < 40) |
| 3426 |
1/2✓ Branch 0 taken 292 times.
✗ Branch 1 not taken.
|
292 | set_qr(qr_MOVINGBLOCK_FAKE_SOLID,1); |
| 3427 |
2/2✓ Branch 0 taken 294 times.
✓ Branch 1 taken 3 times.
|
297 | if(compatrule_version < 41) |
| 3428 |
1/2✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
|
294 | set_qr(qr_BROKENHITBY,1); |
| 3429 |
2/2✓ Branch 0 taken 294 times.
✓ Branch 1 taken 3 times.
|
297 | if(compatrule_version < 42) |
| 3430 |
1/2✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
|
294 | set_qr(qr_BROKEN_MOVING_BOMBS,1); |
| 3431 |
2/2✓ Branch 0 taken 294 times.
✓ Branch 1 taken 3 times.
|
297 | if(compatrule_version < 43) |
| 3432 |
1/2✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
|
294 | set_qr(qr_OLD_BOMB_HITBOXES,1); |
| 3433 |
2/2✓ Branch 0 taken 294 times.
✓ Branch 1 taken 3 times.
|
297 | if(compatrule_version < 44) |
| 3434 |
1/2✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
|
294 | set_qr(qr_SCROLLWARP_NO_RESET_FRAME,1); |
| 3435 |
2/2✓ Branch 0 taken 294 times.
✓ Branch 1 taken 3 times.
|
297 | if(compatrule_version < 45) |
| 3436 |
1/2✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
|
294 | set_qr(qr_ENEMIES_DONT_SCRIPT_FIRST_FRAME,1); |
| 3437 |
2/2✓ Branch 0 taken 294 times.
✓ Branch 1 taken 3 times.
|
297 | if(compatrule_version < 46) |
| 3438 |
1/2✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
|
294 | set_qr(qr_BROKEN_RAFT_SCROLL,1); |
| 3439 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 5 times.
|
297 | if(compatrule_version < 47) |
| 3440 | { | ||
| 3441 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_SENSITIVE_SOLID_DAMAGE,1); |
| 3442 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_OLD_CONVEYOR_COLLISION,1); |
| 3443 | 298 | } | |
| 3444 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 5 times.
|
303 | if(compatrule_version < 48) |
| 3445 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_OLD_GUY_HANDLING,1); |
| 3446 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 5 times.
|
303 | if(compatrule_version < 49) |
| 3447 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_FAIRY_FLAG_COMPAT,1); |
| 3448 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 5 times.
|
303 | if(compatrule_version < 50) |
| 3449 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_OLD_LENS_LAYEREFFECT,1); |
| 3450 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 5 times.
|
303 | if(compatrule_version < 51) |
| 3451 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_PUSHBLOCK_SPRITE_LAYER,1); |
| 3452 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 5 times.
|
303 | if (compatrule_version < 52) |
| 3453 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_OLD_SCRIPT_VOLUME, 1); |
| 3454 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 5 times.
|
303 | if(compatrule_version < 53) |
| 3455 | { | ||
| 3456 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_OLD_SUBSCR,1); |
| 3457 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_ITM_0_INVIS_ON_BTNS,1); |
| 3458 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_OLD_GAUGE_TILE_LAYOUT,1); |
| 3459 | 298 | } | |
| 3460 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 5 times.
|
303 | if(compatrule_version < 54) |
| 3461 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_WALKTHROUGHWALL_NO_DOORSTATE,1); |
| 3462 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 5 times.
|
303 | if(compatrule_version < 55) |
| 3463 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_SPOTLIGHT_IGNR_SOLIDOBJ,1); |
| 3464 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 5 times.
|
303 | if(compatrule_version < 56) |
| 3465 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_BROKEN_LIGHTBEAM_HITBOX,1); |
| 3466 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 5 times.
|
303 | if(compatrule_version < 57) |
| 3467 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_BROKEN_SWORD_SPIN_TRIGGERS,1); |
| 3468 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 5 times.
|
303 | if(compatrule_version < 58) |
| 3469 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_OLD_DMAP_INTRO_STRINGS,1); |
| 3470 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 5 times.
|
303 | if(compatrule_version < 59) |
| 3471 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_SCRIPT_CONTHP_IS_HEARTS,1); |
| 3472 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 5 times.
|
303 | if(compatrule_version < 60) |
| 3473 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_SEPARATE_BOMBABLE_TAPPING_SFX,1); |
| 3474 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 5 times.
|
303 | if(compatrule_version < 61) |
| 3475 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_BROKEN_BOMB_AMMO_COSTS,1); |
| 3476 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 5 times.
|
303 | if(compatrule_version < 62) |
| 3477 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_OLD_BROKEN_WARPEX_MUSIC,1); |
| 3478 |
2/2✓ Branch 0 taken 299 times.
✓ Branch 1 taken 4 times.
|
303 | if(compatrule_version < 63) |
| 3479 | { | ||
| 3480 |
1/2✓ Branch 0 taken 299 times.
✗ Branch 1 not taken.
|
299 | set_qr(qr_BROKEN_LIFTSWIM,1); |
| 3481 |
1/2✓ Branch 0 taken 299 times.
✗ Branch 1 not taken.
|
299 | set_qr(qr_BROKEN_GENERIC_PUSHBLOCK_LOCKING,1); |
| 3482 | 299 | } | |
| 3483 |
2/2✓ Branch 0 taken 299 times.
✓ Branch 1 taken 4 times.
|
303 | if(compatrule_version < 64) |
| 3484 |
1/2✓ Branch 0 taken 299 times.
✗ Branch 1 not taken.
|
299 | set_qr(qr_BROKEN_FLAME_ARROW_REFLECTING,1); |
| 3485 |
2/2✓ Branch 0 taken 324 times.
✓ Branch 1 taken 21 times.
|
303 | if(compatrule_version < 65) |
| 3486 |
1/2✓ Branch 0 taken 324 times.
✗ Branch 1 not taken.
|
324 | set_qr(qr_BROKEN_SIDEVIEW_SPRITE_JUMP,1); |
| 3487 |
2/2✓ Branch 0 taken 327 times.
✓ Branch 1 taken 18 times.
|
345 | if(compatrule_version < 66) |
| 3488 |
1/2✓ Branch 0 taken 327 times.
✗ Branch 1 not taken.
|
327 | set_qr(qr_NEWDARK_TRANS_STACKING,1); |
| 3489 |
2/2✓ Branch 0 taken 327 times.
✓ Branch 1 taken 18 times.
|
345 | if(compatrule_version < 67) |
| 3490 |
1/2✓ Branch 0 taken 327 times.
✗ Branch 1 not taken.
|
327 | set_qr(qr_OLD_HERO_WARP_RETSQUARE,1); |
| 3491 |
2/2✓ Branch 0 taken 327 times.
✓ Branch 1 taken 18 times.
|
345 | if(compatrule_version < 68) |
| 3492 |
1/2✓ Branch 0 taken 327 times.
✗ Branch 1 not taken.
|
327 | set_qr(qr_SCRIPTS_6_BIT_COLOR,1); |
| 3493 |
2/2✓ Branch 0 taken 327 times.
✓ Branch 1 taken 18 times.
|
345 | if(compatrule_version < 69) |
| 3494 |
1/2✓ Branch 0 taken 327 times.
✗ Branch 1 not taken.
|
327 | set_qr(qr_SETENEMYWEAPONSOUNDSONWPNCHANGE, 1); |
| 3495 |
2/2✓ Branch 0 taken 327 times.
✓ Branch 1 taken 18 times.
|
345 | if (compatrule_version < 70) |
| 3496 |
1/2✓ Branch 0 taken 327 times.
✗ Branch 1 not taken.
|
327 | set_qr(qr_BROKEN_CONVEYORS, 1); |
| 3497 |
2/2✓ Branch 0 taken 327 times.
✓ Branch 1 taken 18 times.
|
345 | if (compatrule_version < 71) |
| 3498 |
1/2✓ Branch 0 taken 327 times.
✗ Branch 1 not taken.
|
327 | set_qr(qr_BROKEN_PUSHBLOCK_TOP_HALF_SOLIDS, 1); |
| 3499 |
2/2✓ Branch 0 taken 327 times.
✓ Branch 1 taken 18 times.
|
345 | if (compatrule_version < 72) |
| 3500 |
1/2✓ Branch 0 taken 327 times.
✗ Branch 1 not taken.
|
327 | set_qr(qr_BROKEN_PUSHBLOCK_FLAG_CLONING, 1); |
| 3501 |
2/2✓ Branch 0 taken 327 times.
✓ Branch 1 taken 18 times.
|
345 | if (compatrule_version < 73) |
| 3502 | { | ||
| 3503 |
1/2✓ Branch 0 taken 327 times.
✗ Branch 1 not taken.
|
327 | set_qr(qr_OLD_LANDING_SFX, 1); |
| 3504 |
1/2✓ Branch 0 taken 327 times.
✗ Branch 1 not taken.
|
327 | set_qr(qr_FIRE_LEVEL_TRIGGERS_ARENT_WEAPONS, 1); |
| 3505 | 327 | } | |
| 3506 |
5/6✓ Branch 0 taken 327 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 326 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 326 times.
✗ Branch 5 not taken.
|
345 | if (compatrule_version < 74 && (tempheader.version_major >= 3 || tempheader.compareVer(2, 55, 9) < 0)) |
| 3507 |
2/2✓ Branch 0 taken 327 times.
✓ Branch 1 taken 326 times.
|
1 | set_qr(qr_BROKEN_SCRIPTS_SCROLLING_HERO_POSITION, 1); |
| 3508 |
5/6✓ Branch 0 taken 327 times.
✓ Branch 1 taken 344 times.
✓ Branch 2 taken 326 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 326 times.
✗ Branch 5 not taken.
|
671 | if (compatrule_version < 75 && (tempheader.version_major >= 3 || tempheader.compareVer(2, 55, 10) < 0)) |
| 3509 |
2/2✓ Branch 0 taken 327 times.
✓ Branch 1 taken 326 times.
|
1 | set_qr(qr_BROKEN_SCRIPTS_BITMAP_DRAW_ORIGIN, 1); |
| 3510 |
5/6✓ Branch 0 taken 327 times.
✓ Branch 1 taken 670 times.
✓ Branch 2 taken 326 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 326 times.
✗ Branch 5 not taken.
|
997 | if (compatrule_version < 76 && (tempheader.version_major >= 3 || tempheader.compareVer(2, 55, 10) < 0)) |
| 3511 |
2/2✓ Branch 0 taken 327 times.
✓ Branch 1 taken 326 times.
|
1 | set_qr(qr_INVERTED_DARK_COMBO_TRIGGERS, 1); |
| 3512 |
2/2✓ Branch 0 taken 327 times.
✓ Branch 1 taken 996 times.
|
1323 | if (compatrule_version < 77) |
| 3513 |
1/2✓ Branch 0 taken 327 times.
✗ Branch 1 not taken.
|
327 | set_qr(qr_BROKEN_ICY_FLOOR_SIDEVIEW, 1); |
| 3514 |
2/2✓ Branch 0 taken 327 times.
✓ Branch 1 taken 996 times.
|
1323 | if (compatrule_version < 78) |
| 3515 |
1/2✓ Branch 0 taken 327 times.
✗ Branch 1 not taken.
|
327 | set_qr(qr_SCRIPTS_SCREEN_DRAW_LIGHT_NO_OFFSET, 1); |
| 3516 |
2/2✓ Branch 0 taken 327 times.
✓ Branch 1 taken 996 times.
|
1323 | if (compatrule_version < 79) |
| 3517 |
1/2✓ Branch 0 taken 327 times.
✗ Branch 1 not taken.
|
327 | set_qr(qr_BROKEN_SYSTEM_COLORS, 1); |
| 3518 |
2/2✓ Branch 0 taken 327 times.
✓ Branch 1 taken 996 times.
|
1323 | if (compatrule_version < 80) |
| 3519 |
1/2✓ Branch 0 taken 327 times.
✗ Branch 1 not taken.
|
327 | set_qr(qr_ZS_OLD_SUSPEND_FFC, 1); |
| 3520 |
5/6✓ Branch 0 taken 333 times.
✓ Branch 1 taken 990 times.
✓ Branch 2 taken 326 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 326 times.
✗ Branch 5 not taken.
|
1323 | if (compatrule_version < 81 && (tempheader.version_major >= 3 || tempheader.compareVer(2, 55, 10) < 0)) |
| 3521 |
2/2✓ Branch 0 taken 333 times.
✓ Branch 1 taken 326 times.
|
7 | set_qr(qr_BROKEN_SCROLL_INSTEAD_OF_DROWN_FALL, 1); |
| 3522 |
5/6✓ Branch 0 taken 333 times.
✓ Branch 1 taken 1316 times.
✓ Branch 2 taken 326 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 326 times.
✗ Branch 5 not taken.
|
1649 | if (compatrule_version < 81 && (tempheader.version_major >= 3 || tempheader.compareVer(2, 55, 6) < 0)) |
| 3523 |
2/2✓ Branch 0 taken 333 times.
✓ Branch 1 taken 326 times.
|
7 | set_qr(qr_ROPE_ENEMIES_SPEED_NOT_CONFIGURABLE, 1); |
| 3524 |
2/2✓ Branch 0 taken 333 times.
✓ Branch 1 taken 1642 times.
|
1975 | if (compatrule_version < 82) |
| 3525 | { | ||
| 3526 |
1/2✓ Branch 0 taken 333 times.
✗ Branch 1 not taken.
|
333 | set_qr(qr_EW_ROCKS_HARDCODED_BREAK_ON_SOLID, 1); |
| 3527 |
1/2✓ Branch 0 taken 333 times.
✗ Branch 1 not taken.
|
333 | set_qr(qr_IMPRECISE_WEAPON_SOLIDITY_CHECKS, 1); |
| 3528 | 333 | } | |
| 3529 |
5/6✓ Branch 0 taken 333 times.
✓ Branch 1 taken 1642 times.
✓ Branch 2 taken 326 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 326 times.
✗ Branch 5 not taken.
|
1975 | if (compatrule_version < 83 && (tempheader.version_major >= 3 || tempheader.compareVer(2, 55, 11) < 0)) |
| 3530 |
2/2✓ Branch 0 taken 333 times.
✓ Branch 1 taken 326 times.
|
7 | set_qr(qr_BROKEN_BLOCKHOLE_PITFALLS, 1); |
| 3531 |
5/6✓ Branch 0 taken 333 times.
✓ Branch 1 taken 1968 times.
✓ Branch 2 taken 326 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 326 times.
✗ Branch 5 not taken.
|
2301 | if (compatrule_version < 84 && (tempheader.version_major >= 3 || tempheader.compareVer(2, 55, 11) < 0)) |
| 3532 |
2/2✓ Branch 0 taken 333 times.
✓ Branch 1 taken 326 times.
|
7 | set_qr(qr_CUSTOM_WEAPON_BROKEN_SIZE, 1); |
| 3533 |
2/2✓ Branch 0 taken 333 times.
✓ Branch 1 taken 2294 times.
|
2627 | if (compatrule_version < 85) |
| 3534 |
1/2✓ Branch 0 taken 333 times.
✗ Branch 1 not taken.
|
333 | set_qr(qr_OLD_WEAPON_REFLECTION, 1); |
| 3535 |
5/6✓ Branch 0 taken 343 times.
✓ Branch 1 taken 2284 times.
✓ Branch 2 taken 326 times.
✓ Branch 3 taken 17 times.
✓ Branch 4 taken 326 times.
✗ Branch 5 not taken.
|
2627 | if (compatrule_version < 86 && (tempheader.version_major >= 3 || tempheader.compareVer(2, 55, 11) < 0)) |
| 3536 |
2/2✓ Branch 0 taken 343 times.
✓ Branch 1 taken 326 times.
|
17 | set_qr(qr_OLD_SPRITE_FALL_DROWN, 1); |
| 3537 |
2/2✓ Branch 0 taken 343 times.
✓ Branch 1 taken 2610 times.
|
2953 | if (compatrule_version < 87) |
| 3538 |
1/2✓ Branch 0 taken 343 times.
✗ Branch 1 not taken.
|
343 | set_qr(qr_OLD_TERMINAL_VELOCITY, 1); |
| 3539 |
2/2✓ Branch 0 taken 343 times.
✓ Branch 1 taken 2610 times.
|
2953 | if (compatrule_version < 88) |
| 3540 |
1/2✓ Branch 0 taken 343 times.
✗ Branch 1 not taken.
|
343 | set_qr(qr_OLD_SCRIPT_LEVEL_GLOBAL_STATES, 1); |
| 3541 |
2/2✓ Branch 0 taken 343 times.
✓ Branch 1 taken 2610 times.
|
2953 | if (compatrule_version < 89) |
| 3542 |
1/2✓ Branch 0 taken 343 times.
✗ Branch 1 not taken.
|
343 | set_qr(qr_BROKEN_ARMOS_GRAVE_BIGHITBOX_COLLISION, 1); |
| 3543 | |||
| 3544 |
2/2✓ Branch 0 taken 343 times.
✓ Branch 1 taken 2610 times.
|
2953 | if (compatrule_version < 90) |
| 3545 | { | ||
| 3546 |
1/2✓ Branch 0 taken 343 times.
✗ Branch 1 not taken.
|
343 | set_qr(qr_CLASSIC_DRAWING_ORDER, 1); |
| 3547 |
1/2✓ Branch 0 taken 343 times.
✗ Branch 1 not taken.
|
343 | set_qr(qr_OLD_WEAPON_DRAW_ANIMATE_TIMING, 1); |
| 3548 | 343 | } | |
| 3549 | |||
| 3550 |
2/2✓ Branch 0 taken 345 times.
✓ Branch 1 taken 2608 times.
|
2953 | if (compatrule_version < 91) |
| 3551 | { | ||
| 3552 |
1/2✓ Branch 0 taken 345 times.
✗ Branch 1 not taken.
|
345 | set_qr(qr_OLD_SCRIPTS_INTERNAL_ARRAYS_BOUND_INDEX, 1); |
| 3553 |
1/2✓ Branch 0 taken 345 times.
✗ Branch 1 not taken.
|
345 | set_qr(qr_OLD_SCRIPTS_ARRAYS_NON_ZERO_DEFAULT_VALUE, 1); |
| 3554 | 345 | } | |
| 3555 | |||
| 3556 |
5/6✓ Branch 0 taken 345 times.
✓ Branch 1 taken 2608 times.
✓ Branch 2 taken 326 times.
✓ Branch 3 taken 19 times.
✓ Branch 4 taken 326 times.
✗ Branch 5 not taken.
|
2953 | if (compatrule_version < 92 && (tempheader.version_major >= 3 || tempheader.compareVer(2, 55, 11) < 0)) |
| 3557 |
2/2✓ Branch 0 taken 345 times.
✓ Branch 1 taken 326 times.
|
19 | set_qr(qr_OLD_PIT_SENSITIVITY, 1); |
| 3558 | |||
| 3559 |
5/6✓ Branch 0 taken 363 times.
✓ Branch 1 taken 2916 times.
✓ Branch 2 taken 326 times.
✓ Branch 3 taken 37 times.
✓ Branch 4 taken 326 times.
✗ Branch 5 not taken.
|
3279 | if (compatrule_version < 93 && (tempheader.version_major >= 3 || tempheader.compareVer(2, 55, 12) < 0)) |
| 3560 |
2/2✓ Branch 0 taken 363 times.
✓ Branch 1 taken 326 times.
|
37 | set_qr(qr_ACTIVE_SHIELD_PASSIVE_ROC_NO_SCRIPT, 1); |
| 3561 | |||
| 3562 |
2/2✓ Branch 0 taken 363 times.
✓ Branch 1 taken 3242 times.
|
3605 | if (compatrule_version < 94) |
| 3563 |
1/2✓ Branch 0 taken 363 times.
✗ Branch 1 not taken.
|
363 | set_qr(qr_OLD_SCRIPTS_MESSAGE_DATA_BINARY_ENCODING, 1); |
| 3564 |
2/2✓ Branch 0 taken 363 times.
✓ Branch 1 taken 3242 times.
|
3605 | if (compatrule_version < 95) |
| 3565 |
1/2✓ Branch 0 taken 363 times.
✗ Branch 1 not taken.
|
363 | set_qr(qr_ONLY_MARK_SCREENS_VISITED_IF_MAP_VIEWABLE, 1); |
| 3566 |
2/2✓ Branch 0 taken 363 times.
✓ Branch 1 taken 3242 times.
|
3605 | if (compatrule_version < 96) |
| 3567 |
1/2✓ Branch 0 taken 363 times.
✗ Branch 1 not taken.
|
363 | set_qr(qr_ACTIVE_SUB_IGNORE_8PX, 1); |
| 3568 |
2/2✓ Branch 0 taken 363 times.
✓ Branch 1 taken 3242 times.
|
3605 | if (compatrule_version < 97) |
| 3569 | { | ||
| 3570 |
1/2✓ Branch 0 taken 363 times.
✗ Branch 1 not taken.
|
363 | set_qr(qr_DRAWCOMBO_IGNORES_FRAME, 1); |
| 3571 |
1/2✓ Branch 0 taken 363 times.
✗ Branch 1 not taken.
|
363 | set_qr(qr_DRAWTILE_TALL_DRAWS_WRAP_POORLY, 1); |
| 3572 | 363 | } | |
| 3573 |
2/2✓ Branch 0 taken 363 times.
✓ Branch 1 taken 3242 times.
|
3605 | if (compatrule_version < 98) |
| 3574 |
1/2✓ Branch 0 taken 363 times.
✗ Branch 1 not taken.
|
363 | set_qr(qr_BUGGY_MULTIPLE_WIND, 1); |
| 3575 |
2/2✓ Branch 0 taken 363 times.
✓ Branch 1 taken 3242 times.
|
3605 | if (compatrule_version < 99) |
| 3576 |
1/2✓ Branch 0 taken 363 times.
✗ Branch 1 not taken.
|
363 | set_qr(qr_NO_DEATH_EVENTS_FOR_SEGMENTED_ENEMY_CORES, 1); |
| 3577 |
2/2✓ Branch 0 taken 364 times.
✓ Branch 1 taken 3241 times.
|
3605 | if (compatrule_version < 100) |
| 3578 |
1/2✓ Branch 0 taken 364 times.
✗ Branch 1 not taken.
|
364 | set_qr(qr_BROKEN_COPYCAT_SELF_TRIGGER, 1); |
| 3579 |
2/2✓ Branch 0 taken 419 times.
✓ Branch 1 taken 3186 times.
|
3605 | if (compatrule_version < 101) |
| 3580 |
1/2✓ Branch 0 taken 419 times.
✗ Branch 1 not taken.
|
419 | set_qr(qr_BROKEN_WATER_PASSIVE_DAMAGE, 1); |
| 3581 | |||
| 3582 |
2/2✓ Branch 0 taken 496 times.
✓ Branch 1 taken 3109 times.
|
3605 | set_qr(qr_ANIMATECUSTOMWEAPONS,0); |
| 3583 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 215 times.
|
496 | if (s_version < 16) |
| 3584 |
1/2✓ Branch 0 taken 281 times.
✗ Branch 1 not taken.
|
281 | set_qr(qr_BROKEN_HORIZONTAL_WEAPON_ANIM,1); |
| 3585 | |||
| 3586 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | *Header = tempheader; |
| 3587 | |||
| 3588 | 496 | return 0; | |
| 3589 | 22660 | } | |
| 3590 | |||
| 3591 | 4213854 | void init_msgstr(MsgStr *str) | |
| 3592 | { | ||
| 3593 |
2/4✓ Branch 0 taken 4213854 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4213854 times.
|
4213854 | str->setFromLegacyEncoding(""); |
| 3594 | 4213854 | str->nextstring=0; | |
| 3595 | 4213854 | str->tile=0; | |
| 3596 | 4213854 | str->cset=0; | |
| 3597 | 4213854 | str->trans=false; | |
| 3598 | 4213854 | str->font=font_zfont; | |
| 3599 | 4213854 | str->y=32; | |
| 3600 | 4213854 | str->sfx=18; | |
| 3601 | 4213854 | str->listpos=0; | |
| 3602 | 4213854 | str->x=24; | |
| 3603 | 4213854 | str->w=get_qr(qr_STRING_FRAME_OLD_WIDTH_HEIGHT)!=0 ? 24*8 : 26*8; | |
| 3604 | 4213854 | str->h=get_qr(qr_STRING_FRAME_OLD_WIDTH_HEIGHT)!=0 ? 3*8 : 5*8; | |
| 3605 | 4213854 | str->hspace=0; | |
| 3606 | 4213854 | str->vspace=0; | |
| 3607 | 4213854 | str->stringflags=0; | |
| 3608 | 4213854 | str->margins[up] = 8; | |
| 3609 | 4213854 | str->margins[down] = 0; | |
| 3610 | 4213854 | str->margins[left] = 8; | |
| 3611 | 4213854 | str->margins[right] = 8; | |
| 3612 | 4213854 | str->portrait_tile = 0; | |
| 3613 | 4213854 | str->portrait_cset = 0; | |
| 3614 | 4213854 | str->portrait_x = 0; | |
| 3615 | 4213854 | str->portrait_y = 0; | |
| 3616 | 4213854 | str->portrait_tw = 1; | |
| 3617 | 4213854 | str->portrait_th = 1; | |
| 3618 | 4213854 | str->shadow_type = 0; | |
| 3619 | 4213854 | str->shadow_color = 0; | |
| 3620 | 4213854 | str->drawlayer = 6; | |
| 3621 | 4213854 | } | |
| 3622 | |||
| 3623 | 496 | void init_msgstrings(int32_t start, int32_t end) | |
| 3624 | { | ||
| 3625 |
2/4✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 496 times.
|
496 | if(end <= start || end-start > msg_strings_size) |
| 3626 | ✗ | return; | |
| 3627 | |||
| 3628 |
2/2✓ Branch 0 taken 496 times.
✓ Branch 1 taken 4063232 times.
|
4063728 | for(int32_t i=start; i<end; i++) |
| 3629 | { | ||
| 3630 | 4063232 | init_msgstr(&MsgStrings[i]); | |
| 3631 | 4063232 | MsgStrings[i].listpos=i; | |
| 3632 | 4063232 | } | |
| 3633 | |||
| 3634 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 496 times.
|
496 | if(start==0) |
| 3635 | { | ||
| 3636 |
2/4✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 496 times.
|
496 | MsgStrings[0].setFromLegacyEncoding("(None)"); |
| 3637 | 496 | MsgStrings[0].listpos = 0; | |
| 3638 | 496 | } | |
| 3639 | 496 | } | |
| 3640 | |||
| 3641 | 497 | int32_t readstrings(PACKFILE *f, zquestheader *Header) | |
| 3642 | { | ||
| 3643 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 24 times.
|
497 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_strings); |
| 3644 | |||
| 3645 | 497 | MsgStr tempMsgString; | |
| 3646 |
1/2✓ Branch 0 taken 497 times.
✗ Branch 1 not taken.
|
497 | init_msgstr(&tempMsgString); |
| 3647 | |||
| 3648 | 497 | word temp_msg_count=0; | |
| 3649 | word temp_expansion[16]; | ||
| 3650 | 497 | memset(temp_expansion, 0, 16*sizeof(word)); | |
| 3651 | 497 | char buf[8193] = {0}; | |
| 3652 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 473 times.
|
497 | if(Header->zelda_version < 0x193) |
| 3653 | { | ||
| 3654 | byte tempbyte; | ||
| 3655 | 24 | int32_t strings_to_read=0; | |
| 3656 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 1 times.
|
24 | if (!should_skip) |
| 3657 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | set_qr(qr_OLD_STRING_EDITOR_MARGINS,true); |
| 3658 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
30 | if((Header->zelda_version < 0x192)|| |
| 3659 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((Header->zelda_version == 0x192)&&(Header->build<31))) |
| 3660 | { | ||
| 3661 | 18 | strings_to_read=128; | |
| 3662 | 18 | temp_msg_count=Header->old_str_count; | |
| 3663 | |||
| 3664 | // Some sort of string count corruption seems to be common in old quests | ||
| 3665 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(temp_msg_count>128) |
| 3666 | { | ||
| 3667 | ✗ | temp_msg_count=128; | |
| 3668 | ✗ | } | |
| 3669 | 18 | } | |
| 3670 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | else if((Header->zelda_version == 0x192)&&(Header->build<140)) |
| 3671 | { | ||
| 3672 | ✗ | strings_to_read=255; | |
| 3673 | ✗ | temp_msg_count=Header->old_str_count; | |
| 3674 | ✗ | } | |
| 3675 | else | ||
| 3676 | { | ||
| 3677 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | if(!p_igetw(&temp_msg_count,f)) |
| 3678 | { | ||
| 3679 | ✗ | return qe_invalid; | |
| 3680 | } | ||
| 3681 | |||
| 3682 | 6 | strings_to_read=temp_msg_count; | |
| 3683 | |||
| 3684 |
3/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
|
6 | if (!should_skip && temp_msg_count >= msg_strings_size) |
| 3685 | { | ||
| 3686 | ✗ | Z_message("Reallocating string buffer...\n"); | |
| 3687 | |||
| 3688 | // if((MsgStrings=(MsgStr*)_al_sane_realloc(MsgStrings,sizeof(MsgStr)*MAXMSGS))==NULL) | ||
| 3689 | // return qe_nomem; | ||
| 3690 | |||
| 3691 | //memset(MsgStrings, 0, sizeof(MsgStr)*MAXMSGS); | ||
| 3692 | ✗ | delete[] MsgStrings; | |
| 3693 | ✗ | MsgStrings = new MsgStr[MAXMSGS]; | |
| 3694 | ✗ | msg_strings_size = MAXMSGS; | |
| 3695 | ✗ | for(auto q = 0; q < msg_strings_size; ++q) | |
| 3696 | { | ||
| 3697 | ✗ | MsgStrings[q].clear(); | |
| 3698 | ✗ | } | |
| 3699 | ✗ | } | |
| 3700 | } | ||
| 3701 | |||
| 3702 | //reset the message strings | ||
| 3703 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 1 times.
|
24 | if (!should_skip) |
| 3704 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | init_msgstrings(0,msg_strings_size); |
| 3705 | |||
| 3706 |
2/2✓ Branch 0 taken 2550 times.
✓ Branch 1 taken 24 times.
|
2574 | for(int32_t x=0; x<strings_to_read; x++) |
| 3707 | { | ||
| 3708 |
1/2✓ Branch 0 taken 2550 times.
✗ Branch 1 not taken.
|
2550 | init_msgstr(&tempMsgString); |
| 3709 | 2550 | tempMsgString.listpos = x; | |
| 3710 | |||
| 3711 |
2/4✓ Branch 0 taken 2550 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2550 times.
✗ Branch 3 not taken.
|
2550 | if(!pfread(buf,73,f)) |
| 3712 | { | ||
| 3713 | ✗ | return qe_invalid; | |
| 3714 | } | ||
| 3715 | |||
| 3716 | 2550 | buf[74] = '\0'; | |
| 3717 |
2/4✓ Branch 0 taken 2550 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2550 times.
✗ Branch 3 not taken.
|
2550 | tempMsgString.setFromLegacyEncoding(buf); |
| 3718 | |||
| 3719 |
2/4✓ Branch 0 taken 2550 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2550 times.
✗ Branch 3 not taken.
|
2550 | if(!p_getc(&tempbyte,f)) |
| 3720 | { | ||
| 3721 | ✗ | return qe_invalid; | |
| 3722 | } | ||
| 3723 | |||
| 3724 |
3/4✓ Branch 0 taken 246 times.
✓ Branch 1 taken 2304 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 246 times.
|
2796 | if((Header->zelda_version < 0x192)|| |
| 3725 |
1/2✓ Branch 0 taken 246 times.
✗ Branch 1 not taken.
|
246 | ((Header->zelda_version == 0x192)&&(Header->build<148))) |
| 3726 | { | ||
| 3727 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2304 times.
|
2304 | tempMsgString.nextstring=tempbyte?x+1:0; |
| 3728 | |||
| 3729 |
2/4✓ Branch 0 taken 2304 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2304 times.
✗ Branch 3 not taken.
|
2304 | if(!p_getc(&tempbyte,f)) |
| 3730 | { | ||
| 3731 | ✗ | return qe_invalid; | |
| 3732 | } | ||
| 3733 | |||
| 3734 |
2/4✓ Branch 0 taken 2304 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2304 times.
✗ Branch 3 not taken.
|
2304 | if(!p_getc(&tempbyte,f)) |
| 3735 | { | ||
| 3736 | ✗ | return qe_invalid; | |
| 3737 | } | ||
| 3738 | 2304 | } | |
| 3739 | else | ||
| 3740 | { | ||
| 3741 |
2/4✓ Branch 0 taken 246 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 246 times.
✗ Branch 3 not taken.
|
246 | if(!p_igetw(&tempMsgString.nextstring,f)) |
| 3742 | { | ||
| 3743 | ✗ | return qe_invalid; | |
| 3744 | } | ||
| 3745 | |||
| 3746 |
2/4✓ Branch 0 taken 246 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 246 times.
✗ Branch 3 not taken.
|
246 | if(!pfread(temp_expansion,32,f)) |
| 3747 | { | ||
| 3748 | ✗ | return qe_invalid; | |
| 3749 | } | ||
| 3750 | } | ||
| 3751 | |||
| 3752 |
2/2✓ Branch 0 taken 2549 times.
✓ Branch 1 taken 1 times.
|
2550 | if (!should_skip) |
| 3753 | { | ||
| 3754 |
1/2✓ Branch 0 taken 2549 times.
✗ Branch 1 not taken.
|
2549 | MsgStrings[x] = tempMsgString; |
| 3755 | 2549 | } | |
| 3756 | 2550 | } | |
| 3757 | 24 | } | |
| 3758 | else | ||
| 3759 | { | ||
| 3760 | int32_t dummy_int; | ||
| 3761 | word s_version; | ||
| 3762 | |||
| 3763 | //section version info | ||
| 3764 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 473 times.
✗ Branch 3 not taken.
|
473 | if(!p_igetw(&s_version,f)) |
| 3765 | { | ||
| 3766 | ✗ | return qe_invalid; | |
| 3767 | } | ||
| 3768 | |||
| 3769 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if (s_version > V_STRINGS) |
| 3770 | ✗ | return qe_version; | |
| 3771 | |||
| 3772 | 473 | FFCore.quest_format[vStrings] = s_version; | |
| 3773 | |||
| 3774 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 473 times.
✗ Branch 3 not taken.
|
473 | if(!read_deprecated_section_cversion(f)) |
| 3775 | { | ||
| 3776 | ✗ | return qe_invalid; | |
| 3777 | } | ||
| 3778 | |||
| 3779 | //section size | ||
| 3780 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 473 times.
✗ Branch 3 not taken.
|
473 | if(!p_igetl(&dummy_int,f)) |
| 3781 | { | ||
| 3782 | ✗ | return qe_invalid; | |
| 3783 | } | ||
| 3784 | |||
| 3785 | //finally... section data | ||
| 3786 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 473 times.
✗ Branch 3 not taken.
|
473 | if(!p_igetw(&temp_msg_count,f)) |
| 3787 | { | ||
| 3788 | ✗ | return qe_invalid; | |
| 3789 | } | ||
| 3790 | |||
| 3791 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
473 | if(temp_msg_count >= msg_strings_size && !should_skip) |
| 3792 | { | ||
| 3793 | ✗ | Z_message("Reallocating string buffer...\n"); | |
| 3794 | |||
| 3795 | ✗ | delete[] MsgStrings; | |
| 3796 | ✗ | MsgStrings = new MsgStr[MAXMSGS]; | |
| 3797 | ✗ | msg_strings_size = MAXMSGS; | |
| 3798 | ✗ | for(auto q = 0; q < msg_strings_size; ++q) | |
| 3799 | { | ||
| 3800 | ✗ | MsgStrings[q].clear(); | |
| 3801 | ✗ | } | |
| 3802 | ✗ | } | |
| 3803 | |||
| 3804 | //reset the message strings | ||
| 3805 |
2/2✓ Branch 0 taken 258 times.
✓ Branch 1 taken 215 times.
|
473 | if(s_version < 7) |
| 3806 |
1/2✓ Branch 0 taken 258 times.
✗ Branch 1 not taken.
|
258 | set_qr(qr_OLD_STRING_EDITOR_MARGINS,true); |
| 3807 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if (!should_skip) |
| 3808 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | init_msgstrings(0,msg_strings_size); |
| 3809 | |||
| 3810 | 473 | int32_t string_length=(s_version<2)?73:145; | |
| 3811 | |||
| 3812 |
2/2✓ Branch 0 taken 147575 times.
✓ Branch 1 taken 473 times.
|
148048 | for(int32_t i=0; i<temp_msg_count; i++) |
| 3813 | { | ||
| 3814 |
1/2✓ Branch 0 taken 147575 times.
✗ Branch 1 not taken.
|
147575 | init_msgstr(&tempMsgString); |
| 3815 |
2/2✓ Branch 0 taken 146437 times.
✓ Branch 1 taken 1138 times.
|
147575 | if (s_version >= 11) |
| 3816 | 1138 | tempMsgString.encoding_type = MsgStr::EncodingType::Ascii; | |
| 3817 | 147575 | tempMsgString.listpos = i; | |
| 3818 |
2/2✓ Branch 0 taken 17714 times.
✓ Branch 1 taken 129861 times.
|
147575 | if(s_version > 8) |
| 3819 | { | ||
| 3820 |
2/4✓ Branch 0 taken 17714 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17714 times.
✗ Branch 3 not taken.
|
17714 | if(!p_igetl(&string_length,f)) |
| 3821 | { | ||
| 3822 | ✗ | return qe_invalid; | |
| 3823 | } | ||
| 3824 | 17714 | } | |
| 3825 | |||
| 3826 |
2/4✓ Branch 0 taken 147575 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 147575 times.
|
147575 | if (string_length < 0 || string_length > 8193) |
| 3827 | { | ||
| 3828 | ✗ | return qe_invalid; | |
| 3829 | } | ||
| 3830 | |||
| 3831 |
2/2✓ Branch 0 taken 142696 times.
✓ Branch 1 taken 4879 times.
|
147575 | if (string_length > 0) |
| 3832 | { | ||
| 3833 |
2/4✓ Branch 0 taken 142696 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 142696 times.
✗ Branch 3 not taken.
|
142696 | if (!pfread(buf, string_length, f)) |
| 3834 | { | ||
| 3835 | ✗ | return qe_invalid; | |
| 3836 | } | ||
| 3837 | 142696 | } | |
| 3838 | else | ||
| 3839 | { | ||
| 3840 | 4879 | buf[0] = 0; | |
| 3841 | } | ||
| 3842 | |||
| 3843 |
2/4✓ Branch 0 taken 147575 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 147575 times.
✗ Branch 3 not taken.
|
147575 | if(!p_igetw(&tempMsgString.nextstring,f)) |
| 3844 | { | ||
| 3845 | ✗ | return qe_invalid; | |
| 3846 | } | ||
| 3847 | |||
| 3848 |
2/2✓ Branch 0 taken 31548 times.
✓ Branch 1 taken 116027 times.
|
147575 | if(s_version<2) |
| 3849 | { | ||
| 3850 | 31548 | buf[72] = '\0'; | |
| 3851 |
2/4✓ Branch 0 taken 31548 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 31548 times.
✗ Branch 3 not taken.
|
31548 | tempMsgString.setFromLegacyEncoding(buf); |
| 3852 | 31548 | } | |
| 3853 | else | ||
| 3854 | { | ||
| 3855 | // June 2008: A bug corrupted the last 4 chars of a string. | ||
| 3856 | // Discard these. | ||
| 3857 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 116027 times.
|
116027 | if (!should_skip) |
| 3858 | { | ||
| 3859 |
1/2✓ Branch 0 taken 116027 times.
✗ Branch 1 not taken.
|
116027 | if(s_version<3) |
| 3860 | { | ||
| 3861 | ✗ | for(int32_t j=140; j<144; j++) | |
| 3862 | { | ||
| 3863 | ✗ | buf[j] = '\0'; | |
| 3864 | ✗ | } | |
| 3865 | ✗ | } | |
| 3866 |
1/2✓ Branch 0 taken 116027 times.
✗ Branch 1 not taken.
|
116027 | if(string_length > 8192) string_length = 8192; |
| 3867 | 116027 | buf[string_length]='\0'; //Force-terminate | |
| 3868 |
2/4✓ Branch 0 taken 116027 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116027 times.
✗ Branch 3 not taken.
|
116027 | tempMsgString.set(buf, tempMsgString.encoding_type); |
| 3869 | 116027 | } | |
| 3870 | |||
| 3871 |
2/2✓ Branch 0 taken 17714 times.
✓ Branch 1 taken 98313 times.
|
116027 | if ( s_version >= 6 ) |
| 3872 | { | ||
| 3873 |
2/4✓ Branch 0 taken 17714 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17714 times.
✗ Branch 3 not taken.
|
17714 | if(!p_igetl(&tempMsgString.tile,f)) |
| 3874 | { | ||
| 3875 | ✗ | return qe_invalid; | |
| 3876 | } | ||
| 3877 | 17714 | } | |
| 3878 | else | ||
| 3879 | { | ||
| 3880 |
2/4✓ Branch 0 taken 98313 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 98313 times.
✗ Branch 3 not taken.
|
98313 | if(!p_igetw(&tempMsgString.tile,f)) |
| 3881 | { | ||
| 3882 | ✗ | return qe_invalid; | |
| 3883 | } | ||
| 3884 | } | ||
| 3885 | |||
| 3886 |
2/4✓ Branch 0 taken 116027 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116027 times.
✗ Branch 3 not taken.
|
116027 | if(!p_getc(&tempMsgString.cset,f)) |
| 3887 | { | ||
| 3888 | ✗ | return qe_invalid; | |
| 3889 | } | ||
| 3890 | |||
| 3891 | byte dummy_char; | ||
| 3892 | |||
| 3893 |
2/4✓ Branch 0 taken 116027 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116027 times.
✗ Branch 3 not taken.
|
116027 | if(!p_getc(&dummy_char,f)) // trans is stored as a char... |
| 3894 | { | ||
| 3895 | ✗ | return qe_invalid; | |
| 3896 | } | ||
| 3897 | |||
| 3898 | 116027 | tempMsgString.trans=dummy_char!=0; | |
| 3899 | |||
| 3900 |
2/4✓ Branch 0 taken 116027 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116027 times.
✗ Branch 3 not taken.
|
116027 | if(!p_getc(&tempMsgString.font,f)) |
| 3901 | { | ||
| 3902 | ✗ | return qe_invalid; | |
| 3903 | } | ||
| 3904 | |||
| 3905 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 116027 times.
|
116027 | if(s_version < 5) |
| 3906 | { | ||
| 3907 | ✗ | if(!p_getc(&tempMsgString.y,f)) | |
| 3908 | { | ||
| 3909 | ✗ | return qe_invalid; | |
| 3910 | } | ||
| 3911 | ✗ | } | |
| 3912 | else | ||
| 3913 | { | ||
| 3914 |
2/4✓ Branch 0 taken 116027 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116027 times.
✗ Branch 3 not taken.
|
116027 | if(!p_igetw(&tempMsgString.x,f)) |
| 3915 | { | ||
| 3916 | ✗ | return qe_invalid; | |
| 3917 | } | ||
| 3918 | |||
| 3919 |
2/4✓ Branch 0 taken 116027 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116027 times.
✗ Branch 3 not taken.
|
116027 | if(!p_igetw(&tempMsgString.y,f)) |
| 3920 | { | ||
| 3921 | ✗ | return qe_invalid; | |
| 3922 | } | ||
| 3923 | |||
| 3924 |
2/4✓ Branch 0 taken 116027 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116027 times.
✗ Branch 3 not taken.
|
116027 | if(!p_igetw(&tempMsgString.w,f)) |
| 3925 | { | ||
| 3926 | ✗ | return qe_invalid; | |
| 3927 | } | ||
| 3928 | |||
| 3929 |
2/4✓ Branch 0 taken 116027 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116027 times.
✗ Branch 3 not taken.
|
116027 | if(!p_igetw(&tempMsgString.h,f)) |
| 3930 | { | ||
| 3931 | ✗ | return qe_invalid; | |
| 3932 | } | ||
| 3933 | |||
| 3934 |
2/4✓ Branch 0 taken 116027 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116027 times.
✗ Branch 3 not taken.
|
116027 | if(!p_getc(&tempMsgString.hspace,f)) |
| 3935 | { | ||
| 3936 | ✗ | return qe_invalid; | |
| 3937 | } | ||
| 3938 | |||
| 3939 |
2/4✓ Branch 0 taken 116027 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116027 times.
✗ Branch 3 not taken.
|
116027 | if(!p_getc(&tempMsgString.vspace,f)) |
| 3940 | { | ||
| 3941 | ✗ | return qe_invalid; | |
| 3942 | } | ||
| 3943 | |||
| 3944 |
2/4✓ Branch 0 taken 116027 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116027 times.
✗ Branch 3 not taken.
|
116027 | if(!p_getc(&tempMsgString.stringflags,f)) |
| 3945 | { | ||
| 3946 | ✗ | return qe_invalid; | |
| 3947 | } | ||
| 3948 | } | ||
| 3949 | |||
| 3950 |
2/2✓ Branch 0 taken 98313 times.
✓ Branch 1 taken 17714 times.
|
116027 | if(s_version >= 7) |
| 3951 | { | ||
| 3952 |
2/2✓ Branch 0 taken 17714 times.
✓ Branch 1 taken 70856 times.
|
88570 | for(int32_t q = 0; q < 4; ++q) |
| 3953 | { | ||
| 3954 |
2/4✓ Branch 0 taken 70856 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 70856 times.
✗ Branch 3 not taken.
|
70856 | if(!p_getc(&tempMsgString.margins[q],f)) |
| 3955 | { | ||
| 3956 | ✗ | return qe_invalid; | |
| 3957 | } | ||
| 3958 | 70856 | } | |
| 3959 | |||
| 3960 |
2/4✓ Branch 0 taken 17714 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17714 times.
✗ Branch 3 not taken.
|
17714 | if(!p_igetl(&tempMsgString.portrait_tile,f)) |
| 3961 | { | ||
| 3962 | ✗ | return qe_invalid; | |
| 3963 | } | ||
| 3964 | |||
| 3965 |
2/4✓ Branch 0 taken 17714 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17714 times.
✗ Branch 3 not taken.
|
17714 | if(!p_getc(&tempMsgString.portrait_cset,f)) |
| 3966 | { | ||
| 3967 | ✗ | return qe_invalid; | |
| 3968 | } | ||
| 3969 | |||
| 3970 |
2/4✓ Branch 0 taken 17714 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17714 times.
✗ Branch 3 not taken.
|
17714 | if(!p_getc(&tempMsgString.portrait_x,f)) |
| 3971 | { | ||
| 3972 | ✗ | return qe_invalid; | |
| 3973 | } | ||
| 3974 | |||
| 3975 |
2/4✓ Branch 0 taken 17714 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17714 times.
✗ Branch 3 not taken.
|
17714 | if(!p_getc(&tempMsgString.portrait_y,f)) |
| 3976 | { | ||
| 3977 | ✗ | return qe_invalid; | |
| 3978 | } | ||
| 3979 | |||
| 3980 |
2/4✓ Branch 0 taken 17714 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17714 times.
✗ Branch 3 not taken.
|
17714 | if(!p_getc(&tempMsgString.portrait_tw,f)) |
| 3981 | { | ||
| 3982 | ✗ | return qe_invalid; | |
| 3983 | } | ||
| 3984 | |||
| 3985 |
2/4✓ Branch 0 taken 17714 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17714 times.
✗ Branch 3 not taken.
|
17714 | if(!p_getc(&tempMsgString.portrait_th,f)) |
| 3986 | { | ||
| 3987 | ✗ | return qe_invalid; | |
| 3988 | } | ||
| 3989 | 17714 | } | |
| 3990 | |||
| 3991 |
2/2✓ Branch 0 taken 17714 times.
✓ Branch 1 taken 98313 times.
|
116027 | if(s_version >= 8) |
| 3992 | { | ||
| 3993 |
2/4✓ Branch 0 taken 17714 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17714 times.
✗ Branch 3 not taken.
|
17714 | if(!p_getc(&tempMsgString.shadow_type,f)) |
| 3994 | { | ||
| 3995 | ✗ | return qe_invalid; | |
| 3996 | } | ||
| 3997 | |||
| 3998 |
2/4✓ Branch 0 taken 17714 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17714 times.
✗ Branch 3 not taken.
|
17714 | if(!p_getc(&tempMsgString.shadow_color,f)) |
| 3999 | { | ||
| 4000 | ✗ | return qe_invalid; | |
| 4001 | } | ||
| 4002 | 17714 | } | |
| 4003 | |||
| 4004 |
2/2✓ Branch 0 taken 17405 times.
✓ Branch 1 taken 98622 times.
|
116027 | if(s_version >= 10) |
| 4005 | { | ||
| 4006 |
2/4✓ Branch 0 taken 17405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17405 times.
✗ Branch 3 not taken.
|
17405 | if(!p_getc(&tempMsgString.drawlayer,f)) |
| 4007 | { | ||
| 4008 | ✗ | return qe_invalid; | |
| 4009 | } | ||
| 4010 | 17405 | } | |
| 4011 | |||
| 4012 |
2/4✓ Branch 0 taken 116027 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116027 times.
✗ Branch 3 not taken.
|
116027 | if(!p_getc(&tempMsgString.sfx,f)) |
| 4013 | { | ||
| 4014 | ✗ | return qe_invalid; | |
| 4015 | } | ||
| 4016 | |||
| 4017 |
1/2✓ Branch 0 taken 116027 times.
✗ Branch 1 not taken.
|
116027 | if(s_version>3) |
| 4018 | { | ||
| 4019 |
2/4✓ Branch 0 taken 116027 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116027 times.
✗ Branch 3 not taken.
|
116027 | if(!p_igetw(&tempMsgString.listpos,f)) |
| 4020 | { | ||
| 4021 | ✗ | return qe_invalid; | |
| 4022 | } | ||
| 4023 | 116027 | } | |
| 4024 | } | ||
| 4025 | |||
| 4026 |
1/2✓ Branch 0 taken 147575 times.
✗ Branch 1 not taken.
|
147575 | if (!should_skip) |
| 4027 | { | ||
| 4028 |
1/2✓ Branch 0 taken 147575 times.
✗ Branch 1 not taken.
|
147575 | MsgStrings[i].copyAll(tempMsgString); |
| 4029 | 147575 | } | |
| 4030 | 147575 | } | |
| 4031 | } | ||
| 4032 | |||
| 4033 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 496 times.
|
497 | if (!should_skip) |
| 4034 | 496 | msg_count=temp_msg_count; | |
| 4035 | |||
| 4036 | 497 | return 0; | |
| 4037 | 497 | } | |
| 4038 | |||
| 4039 | 497 | int32_t readdoorcombosets(PACKFILE *f, zquestheader *Header) | |
| 4040 | { | ||
| 4041 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 24 times.
|
497 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_doors); |
| 4042 | |||
| 4043 |
3/4✓ Branch 0 taken 479 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
503 | if((Header->zelda_version < 0x192)|| |
| 4044 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 473 times.
|
479 | ((Header->zelda_version == 0x192)&&(Header->build<158))) |
| 4045 | { | ||
| 4046 | 18 | return 0; | |
| 4047 | } | ||
| 4048 | |||
| 4049 | 479 | word temp_door_combo_set_count=0; | |
| 4050 | DoorComboSet tempDoorComboSet; | ||
| 4051 | word dummy_word; | ||
| 4052 | int32_t dummy_long; | ||
| 4053 | byte padding; | ||
| 4054 | 479 | int32_t s_version = 0; | |
| 4055 | |||
| 4056 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 478 times.
|
479 | if (!should_skip) |
| 4057 | { | ||
| 4058 | 478 | DoorComboSets = {}; | |
| 4059 | 478 | DoorComboSetNames = {}; | |
| 4060 | 478 | } | |
| 4061 | |||
| 4062 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 473 times.
|
479 | if(Header->zelda_version > 0x192) |
| 4063 | { | ||
| 4064 | //section version info | ||
| 4065 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetw(&s_version,f)) |
| 4066 | { | ||
| 4067 | ✗ | return qe_invalid; | |
| 4068 | } | ||
| 4069 | |||
| 4070 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if (s_version > V_DOORS) |
| 4071 | ✗ | return qe_version; | |
| 4072 | |||
| 4073 | 473 | FFCore.quest_format[vDoors] = s_version; | |
| 4074 | |||
| 4075 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetw(&dummy_word,f)) |
| 4076 | { | ||
| 4077 | ✗ | return qe_invalid; | |
| 4078 | } | ||
| 4079 | |||
| 4080 | //section size | ||
| 4081 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetl(&dummy_long,f)) |
| 4082 | { | ||
| 4083 | ✗ | return qe_invalid; | |
| 4084 | } | ||
| 4085 | 473 | } | |
| 4086 | |||
| 4087 | //finally... section data | ||
| 4088 |
1/2✓ Branch 0 taken 479 times.
✗ Branch 1 not taken.
|
479 | if(!p_igetw(&temp_door_combo_set_count,f)) |
| 4089 | { | ||
| 4090 | ✗ | return qe_invalid; | |
| 4091 | } | ||
| 4092 | |||
| 4093 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 479 times.
|
479 | if (temp_door_combo_set_count > MAXDOORCOMBOSETS) |
| 4094 | { | ||
| 4095 | ✗ | return qe_invalid; | |
| 4096 | } | ||
| 4097 | |||
| 4098 |
2/2✓ Branch 0 taken 5705 times.
✓ Branch 1 taken 479 times.
|
6184 | for(int32_t i=0; i<temp_door_combo_set_count; i++) |
| 4099 | { | ||
| 4100 | 5705 | memset(&tempDoorComboSet, 0, sizeof(DoorComboSet)); | |
| 4101 | |||
| 4102 | //name | ||
| 4103 | char name[21]; | ||
| 4104 |
1/2✓ Branch 0 taken 5705 times.
✗ Branch 1 not taken.
|
5705 | if(!pfread(&name,sizeof(name),f)) |
| 4105 | { | ||
| 4106 | ✗ | return qe_invalid; | |
| 4107 | } | ||
| 4108 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 5691 times.
|
5705 | if (!should_skip) |
| 4109 | 5691 | DoorComboSetNames[i] = name; | |
| 4110 | |||
| 4111 |
2/2✓ Branch 0 taken 5665 times.
✓ Branch 1 taken 40 times.
|
5705 | if(Header->zelda_version < 0x193) |
| 4112 | { | ||
| 4113 |
1/2✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
|
40 | if(!p_getc(&padding,f)) |
| 4114 | { | ||
| 4115 | ✗ | return qe_invalid; | |
| 4116 | } | ||
| 4117 | 40 | } | |
| 4118 | |||
| 4119 | //up door | ||
| 4120 |
2/2✓ Branch 0 taken 51345 times.
✓ Branch 1 taken 5705 times.
|
57050 | for(int32_t j=0; j<9; j++) |
| 4121 | { | ||
| 4122 |
2/2✓ Branch 0 taken 205380 times.
✓ Branch 1 taken 51345 times.
|
256725 | for(int32_t k=0; k<4; k++) |
| 4123 | { | ||
| 4124 |
1/2✓ Branch 0 taken 205380 times.
✗ Branch 1 not taken.
|
205380 | if(!p_igetw(&tempDoorComboSet.doorcombo_u[j][k],f)) |
| 4125 | { | ||
| 4126 | ✗ | return qe_invalid; | |
| 4127 | } | ||
| 4128 | 205380 | } | |
| 4129 | 51345 | } | |
| 4130 | |||
| 4131 |
2/2✓ Branch 0 taken 51345 times.
✓ Branch 1 taken 5705 times.
|
57050 | for(int32_t j=0; j<9; j++) |
| 4132 | { | ||
| 4133 |
2/2✓ Branch 0 taken 205380 times.
✓ Branch 1 taken 51345 times.
|
256725 | for(int32_t k=0; k<4; k++) |
| 4134 | { | ||
| 4135 |
1/2✓ Branch 0 taken 205380 times.
✗ Branch 1 not taken.
|
205380 | if(!p_getc(&tempDoorComboSet.doorcset_u[j][k],f)) |
| 4136 | { | ||
| 4137 | ✗ | return qe_invalid; | |
| 4138 | } | ||
| 4139 | 205380 | } | |
| 4140 | 51345 | } | |
| 4141 | |||
| 4142 | //down door | ||
| 4143 |
2/2✓ Branch 0 taken 51345 times.
✓ Branch 1 taken 5705 times.
|
57050 | for(int32_t j=0; j<9; j++) |
| 4144 | { | ||
| 4145 |
2/2✓ Branch 0 taken 205380 times.
✓ Branch 1 taken 51345 times.
|
256725 | for(int32_t k=0; k<4; k++) |
| 4146 | { | ||
| 4147 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 205380 times.
|
205380 | if(!p_igetw(&tempDoorComboSet.doorcombo_d[j][k],f)) |
| 4148 | { | ||
| 4149 | ✗ | return qe_invalid; | |
| 4150 | } | ||
| 4151 | 205380 | } | |
| 4152 | 51345 | } | |
| 4153 | |||
| 4154 |
2/2✓ Branch 0 taken 51345 times.
✓ Branch 1 taken 5705 times.
|
57050 | for(int32_t j=0; j<9; j++) |
| 4155 | { | ||
| 4156 |
2/2✓ Branch 0 taken 205380 times.
✓ Branch 1 taken 51345 times.
|
256725 | for(int32_t k=0; k<4; k++) |
| 4157 | { | ||
| 4158 |
1/2✓ Branch 0 taken 205380 times.
✗ Branch 1 not taken.
|
205380 | if(!p_getc(&tempDoorComboSet.doorcset_d[j][k],f)) |
| 4159 | { | ||
| 4160 | ✗ | return qe_invalid; | |
| 4161 | } | ||
| 4162 | 205380 | } | |
| 4163 | 51345 | } | |
| 4164 | |||
| 4165 | //left door | ||
| 4166 |
2/2✓ Branch 0 taken 51345 times.
✓ Branch 1 taken 5705 times.
|
57050 | for(int32_t j=0; j<9; j++) |
| 4167 | { | ||
| 4168 |
2/2✓ Branch 0 taken 308070 times.
✓ Branch 1 taken 51345 times.
|
359415 | for(int32_t k=0; k<6; k++) |
| 4169 | { | ||
| 4170 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 308070 times.
|
308070 | if(!p_igetw(&tempDoorComboSet.doorcombo_l[j][k],f)) |
| 4171 | { | ||
| 4172 | ✗ | return qe_invalid; | |
| 4173 | } | ||
| 4174 | 308070 | } | |
| 4175 | 51345 | } | |
| 4176 | |||
| 4177 |
2/2✓ Branch 0 taken 51345 times.
✓ Branch 1 taken 5705 times.
|
57050 | for(int32_t j=0; j<9; j++) |
| 4178 | { | ||
| 4179 |
2/2✓ Branch 0 taken 308070 times.
✓ Branch 1 taken 51345 times.
|
359415 | for(int32_t k=0; k<6; k++) |
| 4180 | { | ||
| 4181 |
1/2✓ Branch 0 taken 308070 times.
✗ Branch 1 not taken.
|
308070 | if(!p_getc(&tempDoorComboSet.doorcset_l[j][k],f)) |
| 4182 | { | ||
| 4183 | ✗ | return qe_invalid; | |
| 4184 | } | ||
| 4185 | 308070 | } | |
| 4186 | 51345 | } | |
| 4187 | |||
| 4188 | //right door | ||
| 4189 |
2/2✓ Branch 0 taken 51345 times.
✓ Branch 1 taken 5705 times.
|
57050 | for(int32_t j=0; j<9; j++) |
| 4190 | { | ||
| 4191 |
2/2✓ Branch 0 taken 308070 times.
✓ Branch 1 taken 51345 times.
|
359415 | for(int32_t k=0; k<6; k++) |
| 4192 | { | ||
| 4193 |
1/2✓ Branch 0 taken 308070 times.
✗ Branch 1 not taken.
|
308070 | if(!p_igetw(&tempDoorComboSet.doorcombo_r[j][k],f)) |
| 4194 | { | ||
| 4195 | ✗ | return qe_invalid; | |
| 4196 | } | ||
| 4197 | 308070 | } | |
| 4198 | 51345 | } | |
| 4199 | |||
| 4200 |
2/2✓ Branch 0 taken 51345 times.
✓ Branch 1 taken 5705 times.
|
57050 | for(int32_t j=0; j<9; j++) |
| 4201 | { | ||
| 4202 |
2/2✓ Branch 0 taken 308070 times.
✓ Branch 1 taken 51345 times.
|
359415 | for(int32_t k=0; k<6; k++) |
| 4203 | { | ||
| 4204 |
1/2✓ Branch 0 taken 308070 times.
✗ Branch 1 not taken.
|
308070 | if(!p_getc(&tempDoorComboSet.doorcset_r[j][k],f)) |
| 4205 | { | ||
| 4206 | ✗ | return qe_invalid; | |
| 4207 | } | ||
| 4208 | 308070 | } | |
| 4209 | 51345 | } | |
| 4210 | |||
| 4211 | //up bomb rubble | ||
| 4212 |
2/2✓ Branch 0 taken 11410 times.
✓ Branch 1 taken 5705 times.
|
17115 | for(int32_t j=0; j<2; j++) |
| 4213 | { | ||
| 4214 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11410 times.
|
11410 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_u[j],f)) |
| 4215 | { | ||
| 4216 | ✗ | return qe_invalid; | |
| 4217 | } | ||
| 4218 | 11410 | } | |
| 4219 | |||
| 4220 |
2/2✓ Branch 0 taken 11410 times.
✓ Branch 1 taken 5705 times.
|
17115 | for(int32_t j=0; j<2; j++) |
| 4221 | { | ||
| 4222 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11410 times.
|
11410 | if(!p_getc(&tempDoorComboSet.bombdoorcset_u[j],f)) |
| 4223 | { | ||
| 4224 | ✗ | return qe_invalid; | |
| 4225 | } | ||
| 4226 | 11410 | } | |
| 4227 | |||
| 4228 | //down bomb rubble | ||
| 4229 |
2/2✓ Branch 0 taken 11410 times.
✓ Branch 1 taken 5705 times.
|
17115 | for(int32_t j=0; j<2; j++) |
| 4230 | { | ||
| 4231 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11410 times.
|
11410 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_d[j],f)) |
| 4232 | { | ||
| 4233 | ✗ | return qe_invalid; | |
| 4234 | } | ||
| 4235 | 11410 | } | |
| 4236 | |||
| 4237 |
2/2✓ Branch 0 taken 11410 times.
✓ Branch 1 taken 5705 times.
|
17115 | for(int32_t j=0; j<2; j++) |
| 4238 | { | ||
| 4239 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11410 times.
|
11410 | if(!p_getc(&tempDoorComboSet.bombdoorcset_d[j],f)) |
| 4240 | { | ||
| 4241 | ✗ | return qe_invalid; | |
| 4242 | } | ||
| 4243 | 11410 | } | |
| 4244 | |||
| 4245 | //left bomb rubble | ||
| 4246 |
2/2✓ Branch 0 taken 17115 times.
✓ Branch 1 taken 5705 times.
|
22820 | for(int32_t j=0; j<3; j++) |
| 4247 | { | ||
| 4248 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17115 times.
|
17115 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_l[j],f)) |
| 4249 | { | ||
| 4250 | ✗ | return qe_invalid; | |
| 4251 | } | ||
| 4252 | 17115 | } | |
| 4253 | |||
| 4254 |
2/2✓ Branch 0 taken 17115 times.
✓ Branch 1 taken 5705 times.
|
22820 | for(int32_t j=0; j<3; j++) |
| 4255 | { | ||
| 4256 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17115 times.
|
17115 | if(!p_getc(&tempDoorComboSet.bombdoorcset_l[j],f)) |
| 4257 | { | ||
| 4258 | ✗ | return qe_invalid; | |
| 4259 | } | ||
| 4260 | 17115 | } | |
| 4261 | |||
| 4262 |
2/2✓ Branch 0 taken 5665 times.
✓ Branch 1 taken 40 times.
|
5705 | if(Header->zelda_version < 0x193) |
| 4263 | { | ||
| 4264 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | if(!p_getc(&padding,f)) |
| 4265 | { | ||
| 4266 | ✗ | return qe_invalid; | |
| 4267 | } | ||
| 4268 | |||
| 4269 | 40 | } | |
| 4270 | |||
| 4271 | //right bomb rubble | ||
| 4272 |
2/2✓ Branch 0 taken 17115 times.
✓ Branch 1 taken 5705 times.
|
22820 | for(int32_t j=0; j<3; j++) |
| 4273 | { | ||
| 4274 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17115 times.
|
17115 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_r[j],f)) |
| 4275 | { | ||
| 4276 | ✗ | return qe_invalid; | |
| 4277 | } | ||
| 4278 | 17115 | } | |
| 4279 | |||
| 4280 |
2/2✓ Branch 0 taken 17115 times.
✓ Branch 1 taken 5705 times.
|
22820 | for(int32_t j=0; j<3; j++) |
| 4281 | { | ||
| 4282 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17115 times.
|
17115 | if(!p_getc(&tempDoorComboSet.bombdoorcset_r[j],f)) |
| 4283 | { | ||
| 4284 | ✗ | return qe_invalid; | |
| 4285 | } | ||
| 4286 | 17115 | } | |
| 4287 | |||
| 4288 |
2/2✓ Branch 0 taken 5665 times.
✓ Branch 1 taken 40 times.
|
5705 | if(Header->zelda_version < 0x193) |
| 4289 | { | ||
| 4290 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | if(!p_getc(&padding,f)) |
| 4291 | { | ||
| 4292 | ✗ | return qe_invalid; | |
| 4293 | } | ||
| 4294 | 40 | } | |
| 4295 | |||
| 4296 | //walkthrough stuff | ||
| 4297 |
2/2✓ Branch 0 taken 22820 times.
✓ Branch 1 taken 5705 times.
|
28525 | for(int32_t j=0; j<4; j++) |
| 4298 | { | ||
| 4299 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22820 times.
|
22820 | if(!p_igetw(&tempDoorComboSet.walkthroughcombo[j],f)) |
| 4300 | { | ||
| 4301 | ✗ | return qe_invalid; | |
| 4302 | } | ||
| 4303 | 22820 | } | |
| 4304 | |||
| 4305 |
2/2✓ Branch 0 taken 22820 times.
✓ Branch 1 taken 5705 times.
|
28525 | for(int32_t j=0; j<4; j++) |
| 4306 | { | ||
| 4307 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22820 times.
|
22820 | if(!p_getc(&tempDoorComboSet.walkthroughcset[j],f)) |
| 4308 | { | ||
| 4309 | ✗ | return qe_invalid; | |
| 4310 | } | ||
| 4311 | 22820 | } | |
| 4312 | |||
| 4313 | //flags | ||
| 4314 |
2/2✓ Branch 0 taken 11410 times.
✓ Branch 1 taken 5705 times.
|
17115 | for(int32_t j=0; j<2; j++) |
| 4315 | { | ||
| 4316 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11410 times.
|
11410 | if(!p_getc(&tempDoorComboSet.flags[j],f)) |
| 4317 | { | ||
| 4318 | ✗ | return qe_invalid; | |
| 4319 | } | ||
| 4320 | 11410 | } | |
| 4321 | |||
| 4322 |
2/2✓ Branch 0 taken 5665 times.
✓ Branch 1 taken 40 times.
|
5705 | if(Header->zelda_version < 0x193) |
| 4323 | { | ||
| 4324 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | if(!pfread(&tempDoorComboSet.expansion,sizeof(tempDoorComboSet.expansion),f)) |
| 4325 | { | ||
| 4326 | ✗ | return qe_invalid; | |
| 4327 | } | ||
| 4328 | 40 | } | |
| 4329 | |||
| 4330 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 5691 times.
|
5705 | if (!should_skip) |
| 4331 | 5691 | memcpy(&DoorComboSets[i], &tempDoorComboSet, sizeof(tempDoorComboSet)); | |
| 4332 | 5705 | } | |
| 4333 | |||
| 4334 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 478 times.
|
479 | if (!should_skip) |
| 4335 | 478 | door_combo_set_count=temp_door_combo_set_count; | |
| 4336 | |||
| 4337 | 479 | return 0; | |
| 4338 | 497 | } | |
| 4339 | |||
| 4340 | 9 | int32_t count_dmaps() | |
| 4341 | { | ||
| 4342 | 9 | int32_t i=MAXDMAPS-1; | |
| 4343 | 9 | bool found=false; | |
| 4344 | |||
| 4345 |
4/4✓ Branch 0 taken 9 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 9 times.
|
9 | while(i>=0 && !found) |
| 4346 | { | ||
| 4347 |
4/6✓ Branch 0 taken 9 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
|
27 | if((DMaps[i].map!=0)||(DMaps[i].level!=0)||(DMaps[i].xoff!=0)|| |
| 4348 |
3/6✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
|
9 | (DMaps[i].compass!=0)||(DMaps[i].color!=0)||(DMaps[i].music!=0)|| |
| 4349 |
1/2✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
|
9 | (DMaps[i].cont!=0)||(DMaps[i].type!=0)) |
| 4350 | 18 | found=true; | |
| 4351 | |||
| 4352 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 18 times.
|
90 | for(int32_t j=0; j<8; j++) |
| 4353 | { | ||
| 4354 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 72 times.
|
72 | if(DMaps[i].grid[j]!=0) |
| 4355 | |||
| 4356 | ✗ | found=true; | |
| 4357 | 72 | } | |
| 4358 | |||
| 4359 |
5/6✓ Branch 0 taken 9 times.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 5 taken 9 times.
|
18 | if((DMaps[i].name[0]!=0)||(DMaps[i].title[0]!=0)|| |
| 4360 | ✗ | (DMaps[i].intro[0]!=0)) | |
| 4361 | 27 | found=true; | |
| 4362 | |||
| 4363 |
3/4✓ Branch 0 taken 9 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
|
27 | if((DMaps[i].minimap_tile[0]!=0)||(DMaps[i].minimap_tile[1]!=0)|| |
| 4364 |
2/4✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
|
9 | (DMaps[i].largemap_tile[0]!=0)||(DMaps[i].largemap_tile[1]!=0)|| |
| 4365 |
2/4✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
|
9 | (DMaps[i].minimap_cset[0]!=0)||(DMaps[i].minimap_cset[1]!=0)|| |
| 4366 |
1/2✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
|
9 | (DMaps[i].largemap_cset[0]!=0)||(DMaps[i].largemap_cset[1]!=0)) |
| 4367 | 18 | found=true; | |
| 4368 | |||
| 4369 | ✗ | if(!found) | |
| 4370 | { | ||
| 4371 | ✗ | i--; | |
| 4372 | ✗ | } | |
| 4373 | } | ||
| 4374 | |||
| 4375 | 9 | return i+1; | |
| 4376 | } | ||
| 4377 | |||
| 4378 | |||
| 4379 | 9 | int32_t count_shops(miscQdata *Misc) | |
| 4380 | { | ||
| 4381 | 9 | int32_t i=NUM_SHOPS-1,j; | |
| 4382 | 9 | bool found=false; | |
| 4383 | |||
| 4384 |
4/4✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2234 times.
✓ Branch 2 taken 2229 times.
✓ Branch 3 taken 9 times.
|
2238 | while(i>=0 && !found) |
| 4385 | { | ||
| 4386 | 2229 | j=2; | |
| 4387 | |||
| 4388 |
4/4✓ Branch 0 taken 2224 times.
✓ Branch 1 taken 6682 times.
✓ Branch 2 taken 6677 times.
✓ Branch 3 taken 2229 times.
|
8906 | while(j>=0 && !found) |
| 4389 | { | ||
| 4390 |
3/4✓ Branch 0 taken 6672 times.
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6672 times.
|
6677 | if((Misc->shop[i].hasitem[j]!=0)||(Misc->shop[i].price[j]!=0)) |
| 4391 | { | ||
| 4392 | 5 | found=true; | |
| 4393 | 5 | } | |
| 4394 | else | ||
| 4395 | { | ||
| 4396 | 6672 | j--; | |
| 4397 | } | ||
| 4398 | } | ||
| 4399 | |||
| 4400 |
1/2✓ Branch 0 taken 2229 times.
✗ Branch 1 not taken.
|
2229 | if(Misc->shop[i].name[0]!=0) |
| 4401 | { | ||
| 4402 | ✗ | found=true; | |
| 4403 | ✗ | } | |
| 4404 | |||
| 4405 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 2224 times.
|
2229 | if(!found) |
| 4406 | { | ||
| 4407 | 2224 | i--; | |
| 4408 | 2224 | } | |
| 4409 | } | ||
| 4410 | |||
| 4411 | 9 | return i+1; | |
| 4412 | } | ||
| 4413 | |||
| 4414 | 9 | int32_t count_infos(miscQdata *Misc) | |
| 4415 | { | ||
| 4416 | 9 | int32_t i=255,j; | |
| 4417 | 9 | bool found=false; | |
| 4418 | |||
| 4419 |
4/4✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2234 times.
✓ Branch 2 taken 2229 times.
✓ Branch 3 taken 9 times.
|
2238 | while(i>=0 && !found) |
| 4420 | { | ||
| 4421 | 2229 | j=2; | |
| 4422 | |||
| 4423 |
4/4✓ Branch 0 taken 2224 times.
✓ Branch 1 taken 6682 times.
✓ Branch 2 taken 6677 times.
✓ Branch 3 taken 2229 times.
|
8906 | while(j>=0 && !found) |
| 4424 | { | ||
| 4425 |
4/4✓ Branch 0 taken 6676 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 6672 times.
|
6677 | if((Misc->info[i].str[j]!=0)||(Misc->info[i].price[j]!=0)) |
| 4426 | { | ||
| 4427 | 5 | found=true; | |
| 4428 | 5 | } | |
| 4429 | else | ||
| 4430 | { | ||
| 4431 | 6672 | j--; | |
| 4432 | } | ||
| 4433 | } | ||
| 4434 | |||
| 4435 |
1/2✓ Branch 0 taken 2229 times.
✗ Branch 1 not taken.
|
2229 | if(Misc->info[i].name[0]!=0) |
| 4436 | { | ||
| 4437 | ✗ | found=true; | |
| 4438 | ✗ | } | |
| 4439 | |||
| 4440 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 2224 times.
|
2229 | if(!found) |
| 4441 | { | ||
| 4442 | 2224 | i--; | |
| 4443 | 2224 | } | |
| 4444 | } | ||
| 4445 | |||
| 4446 | 9 | return i+1; | |
| 4447 | } | ||
| 4448 | |||
| 4449 | 9 | int32_t count_warprings(miscQdata *Misc) | |
| 4450 | { | ||
| 4451 | 9 | int32_t i=15,j; | |
| 4452 | 9 | bool found=false; | |
| 4453 | |||
| 4454 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 58 times.
✓ Branch 2 taken 49 times.
✓ Branch 3 taken 9 times.
|
58 | while(i>=0 && !found) |
| 4455 | { | ||
| 4456 | 49 | j=7; | |
| 4457 | |||
| 4458 |
4/4✓ Branch 0 taken 40 times.
✓ Branch 1 taken 367 times.
✓ Branch 2 taken 358 times.
✓ Branch 3 taken 49 times.
|
407 | while(j>=0 && !found) |
| 4459 | { | ||
| 4460 |
4/4✓ Branch 0 taken 354 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 349 times.
|
358 | if((Misc->warp[i].dmap[j]!=0)||(Misc->warp[i].scr[j]!=0)) |
| 4461 | { | ||
| 4462 | 9 | found=true; | |
| 4463 | 9 | } | |
| 4464 | else | ||
| 4465 | { | ||
| 4466 | 349 | j--; | |
| 4467 | } | ||
| 4468 | } | ||
| 4469 | |||
| 4470 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 40 times.
|
49 | if(!found) |
| 4471 | { | ||
| 4472 | 40 | i--; | |
| 4473 | 40 | } | |
| 4474 | } | ||
| 4475 | |||
| 4476 | 9 | return i+1; | |
| 4477 | } | ||
| 4478 | |||
| 4479 | 9 | int32_t count_palcycles(miscQdata *Misc) | |
| 4480 | { | ||
| 4481 | 9 | int32_t i=255,j; | |
| 4482 | 9 | bool found=false; | |
| 4483 | |||
| 4484 |
4/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2043 times.
✓ Branch 2 taken 2036 times.
✓ Branch 3 taken 9 times.
|
2045 | while(i>=0 && !found) |
| 4485 | { | ||
| 4486 | 2036 | j=2; | |
| 4487 | |||
| 4488 |
4/4✓ Branch 0 taken 2029 times.
✓ Branch 1 taken 6101 times.
✓ Branch 2 taken 6094 times.
✓ Branch 3 taken 2036 times.
|
8130 | while(j>=0 && !found) |
| 4489 | { | ||
| 4490 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 6087 times.
|
6094 | if(Misc->cycles[i][j].count!=0) |
| 4491 | { | ||
| 4492 | 7 | found=true; | |
| 4493 | 7 | } | |
| 4494 | else | ||
| 4495 | { | ||
| 4496 | 6087 | j--; | |
| 4497 | } | ||
| 4498 | } | ||
| 4499 | |||
| 4500 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 2029 times.
|
2036 | if(!found) |
| 4501 | { | ||
| 4502 | 2029 | i--; | |
| 4503 | 2029 | } | |
| 4504 | } | ||
| 4505 | |||
| 4506 | 9 | return i+1; | |
| 4507 | } | ||
| 4508 | |||
| 4509 | 192168 | void clear_screen(mapscr *temp_scr) | |
| 4510 | { | ||
| 4511 | 192168 | temp_scr->zero_memory(); | |
| 4512 | 192168 | } | |
| 4513 | |||
| 4514 | // NOTE: when modifying this, you need to also update: | ||
| 4515 | // readdmaps, and FFScript::read_dmaps | ||
| 4516 | // (and their associated write functions) | ||
| 4517 | |||
| 4518 | 232512 | int32_t read_one_dmap(PACKFILE* f, zquestheader *Header, int s_version, int index) | |
| 4519 | { | ||
| 4520 |
2/2✓ Branch 0 taken 230400 times.
✓ Branch 1 taken 2112 times.
|
232512 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_dmaps); |
| 4521 | 232512 | dmap tempDMap; | |
| 4522 |
3/4✓ Branch 0 taken 382 times.
✓ Branch 1 taken 232130 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 382 times.
|
232512 | static AdvancedMusic tempMusic; |
| 4523 | char legacy_title[22]; | ||
| 4524 | byte padding; | ||
| 4525 | |||
| 4526 |
2/2✓ Branch 0 taken 161856 times.
✓ Branch 1 taken 70656 times.
|
232512 | if (s_version < 25) |
| 4527 |
1/2✓ Branch 0 taken 161856 times.
✗ Branch 1 not taken.
|
161856 | tempMusic.clear(); |
| 4528 | |||
| 4529 |
2/2✓ Branch 0 taken 229184 times.
✓ Branch 1 taken 3328 times.
|
232512 | if (!should_skip) |
| 4530 | { | ||
| 4531 |
1/2✓ Branch 0 taken 229184 times.
✗ Branch 1 not taken.
|
229184 | DMaps[index].clear(); |
| 4532 | 229184 | DMaps[index].type |= dmCAVE; | |
| 4533 | 229184 | } | |
| 4534 | |||
| 4535 | { | ||
| 4536 |
2/2✓ Branch 0 taken 229440 times.
✓ Branch 1 taken 3072 times.
|
232512 | tempDMap.clear(); |
| 4537 | 229440 | sprintf(legacy_title," "); | |
| 4538 | 229440 | sprintf(tempDMap.intro," "); | |
| 4539 | |||
| 4540 |
2/4✓ Branch 0 taken 229440 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 229440 times.
✗ Branch 3 not taken.
|
229440 | if(!p_getc(&tempDMap.map,f)) |
| 4541 | { | ||
| 4542 | ✗ | return qe_invalid; | |
| 4543 | } | ||
| 4544 | |||
| 4545 |
2/2✓ Branch 0 taken 16960 times.
✓ Branch 1 taken 212480 times.
|
229440 | if(s_version <= 4) |
| 4546 | { | ||
| 4547 | byte tempbyte; | ||
| 4548 | |||
| 4549 |
2/4✓ Branch 0 taken 16960 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16960 times.
✗ Branch 3 not taken.
|
16960 | if(!p_getc(&tempbyte,f)) |
| 4550 | { | ||
| 4551 | ✗ | return qe_invalid; | |
| 4552 | } | ||
| 4553 | |||
| 4554 | 16960 | tempDMap.level=(word)tempbyte; | |
| 4555 | 16960 | } | |
| 4556 | else | ||
| 4557 | { | ||
| 4558 |
2/4✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 212480 times.
✗ Branch 3 not taken.
|
212480 | if(!p_igetw(&tempDMap.level,f)) |
| 4559 | { | ||
| 4560 | ✗ | return qe_invalid; | |
| 4561 | } | ||
| 4562 | } | ||
| 4563 | |||
| 4564 |
2/4✓ Branch 0 taken 229440 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 229440 times.
✗ Branch 3 not taken.
|
229440 | if(!p_getc(&tempDMap.xoff,f)) |
| 4565 | { | ||
| 4566 | ✗ | return qe_invalid; | |
| 4567 | } | ||
| 4568 | |||
| 4569 |
2/4✓ Branch 0 taken 229440 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 229440 times.
✗ Branch 3 not taken.
|
229440 | if(!p_getc(&tempDMap.compass,f)) |
| 4570 | { | ||
| 4571 | ✗ | return qe_invalid; | |
| 4572 | } | ||
| 4573 | |||
| 4574 |
2/2✓ Branch 0 taken 212480 times.
✓ Branch 1 taken 16960 times.
|
229440 | if(s_version > 8) // February 2009 |
| 4575 | { | ||
| 4576 |
2/4✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 212480 times.
✗ Branch 3 not taken.
|
212480 | if(!p_igetw(&tempDMap.color,f)) |
| 4577 | { | ||
| 4578 | ✗ | return qe_invalid; | |
| 4579 | } | ||
| 4580 | 212480 | } | |
| 4581 | else | ||
| 4582 | { | ||
| 4583 | byte tempbyte; | ||
| 4584 | |||
| 4585 |
2/4✓ Branch 0 taken 16960 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16960 times.
✗ Branch 3 not taken.
|
16960 | if(!p_getc(&tempbyte,f)) |
| 4586 | { | ||
| 4587 | ✗ | return qe_invalid; | |
| 4588 | } | ||
| 4589 | |||
| 4590 | 16960 | tempDMap.color = (word)tempbyte; | |
| 4591 | } | ||
| 4592 | |||
| 4593 |
2/2✓ Branch 0 taken 161856 times.
✓ Branch 1 taken 67584 times.
|
229440 | if (s_version < 25) |
| 4594 | { | ||
| 4595 |
2/4✓ Branch 0 taken 161856 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 161856 times.
✗ Branch 3 not taken.
|
161856 | if(!p_getc(&padding,f)) |
| 4596 | ✗ | return qe_invalid; | |
| 4597 |
1/2✓ Branch 0 taken 161856 times.
✗ Branch 1 not taken.
|
161856 | tempMusic.midi = convert_from_old_midi_id(padding + (MIDIOFFSET_DMAP-MIDIOFFSET_ZSCRIPT)); |
| 4598 | 161856 | } | |
| 4599 | |||
| 4600 |
2/4✓ Branch 0 taken 229440 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 229440 times.
✗ Branch 3 not taken.
|
229440 | if(!p_getc(&tempDMap.cont,f)) |
| 4601 | { | ||
| 4602 | ✗ | return qe_invalid; | |
| 4603 | } | ||
| 4604 | |||
| 4605 |
2/4✓ Branch 0 taken 229440 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 229440 times.
✗ Branch 3 not taken.
|
229440 | if(!p_getc(&tempDMap.type,f)) |
| 4606 | { | ||
| 4607 | ✗ | return qe_invalid; | |
| 4608 | } | ||
| 4609 | |||
| 4610 |
4/4✓ Branch 0 taken 6338 times.
✓ Branch 1 taken 223102 times.
✓ Branch 2 taken 6294 times.
✓ Branch 3 taken 44 times.
|
235778 | if((tempDMap.type & dmfTYPE) == dmOVERW && |
| 4611 |
1/2✓ Branch 0 taken 6338 times.
✗ Branch 1 not taken.
|
6338 | (!Header || Header->zelda_version >= 0x210)) // Not sure exactly when this changed |
| 4612 | 6294 | tempDMap.xoff = 0; | |
| 4613 | |||
| 4614 |
2/2✓ Branch 0 taken 229440 times.
✓ Branch 1 taken 1835520 times.
|
2064960 | for(int32_t j=0; j<8; j++) |
| 4615 | { | ||
| 4616 |
2/4✓ Branch 0 taken 1835520 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1835520 times.
✗ Branch 3 not taken.
|
1835520 | if(!p_getc(&tempDMap.grid[j],f)) |
| 4617 | { | ||
| 4618 | ✗ | return qe_invalid; | |
| 4619 | } | ||
| 4620 | 1835520 | } | |
| 4621 | |||
| 4622 |
5/6✓ Branch 0 taken 229440 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 228864 times.
✓ Branch 3 taken 576 times.
✓ Branch 4 taken 1536 times.
✓ Branch 5 taken 227328 times.
|
229440 | if(Header && ((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<41)))) |
| 4623 | { | ||
| 4624 |
4/4✓ Branch 0 taken 137 times.
✓ Branch 1 taken 1975 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 127 times.
|
2112 | if(tempDMap.level>0&&tempDMap.level<10) |
| 4625 | { | ||
| 4626 | 127 | sprintf(legacy_title,"LEVEL-%d ", tempDMap.level); | |
| 4627 | 127 | } | |
| 4628 |
2/2✓ Branch 0 taken 576 times.
✓ Branch 1 taken 1536 times.
|
2112 | tempDMap.title.assign(legacy_title); |
| 4629 | |||
| 4630 |
3/4✓ Branch 0 taken 18 times.
✓ Branch 1 taken 558 times.
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
|
576 | if(index==0 && Header->zelda_version <= 0x190) |
| 4631 | { | ||
| 4632 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | tempDMap.cont = std::max((int)tempDMap.cont - tempDMap.xoff, 0); |
| 4633 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | tempDMap.compass = std::max((int)tempDMap.compass - tempDMap.xoff, 0); |
| 4634 | 18 | } | |
| 4635 | |||
| 4636 | //forgotten -DD | ||
| 4637 |
2/2✓ Branch 0 taken 137 times.
✓ Branch 1 taken 439 times.
|
576 | if(tempDMap.level==0) |
| 4638 | { | ||
| 4639 | 439 | tempDMap.flags=dmfCAVES|dmf3STAIR|dmfWHIRLWIND|dmfGUYCAVES; | |
| 4640 | 439 | } | |
| 4641 | 576 | } | |
| 4642 | else | ||
| 4643 | { | ||
| 4644 |
3/4✓ Branch 0 taken 228864 times.
✓ Branch 1 taken 1536 times.
✓ Branch 2 taken 228864 times.
✗ Branch 3 not taken.
|
227328 | if(!p_getstr(tempDMap.name,sizeof(DMaps[0].name) - 1,f)) |
| 4645 | { | ||
| 4646 | ✗ | return qe_invalid; | |
| 4647 | } | ||
| 4648 | |||
| 4649 |
2/2✓ Branch 0 taken 127488 times.
✓ Branch 1 taken 101376 times.
|
228864 | if(s_version<20) |
| 4650 | { | ||
| 4651 |
2/4✓ Branch 0 taken 127488 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 127488 times.
✗ Branch 3 not taken.
|
127488 | if (!p_getstr(legacy_title, sizeof(legacy_title) - 1, f)) |
| 4652 | { | ||
| 4653 | ✗ | return qe_invalid; | |
| 4654 | } | ||
| 4655 |
1/2✓ Branch 0 taken 127488 times.
✗ Branch 1 not taken.
|
127488 | tempDMap.title.assign(legacy_title); |
| 4656 | 127488 | } | |
| 4657 | else | ||
| 4658 | { | ||
| 4659 |
2/4✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 101376 times.
✗ Branch 3 not taken.
|
101376 | if (!p_getwstr(&tempDMap.title, f)) |
| 4660 | { | ||
| 4661 | ✗ | return qe_invalid; | |
| 4662 | } | ||
| 4663 | } | ||
| 4664 | |||
| 4665 |
2/4✓ Branch 0 taken 228864 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 228864 times.
✗ Branch 3 not taken.
|
228864 | if(!p_getstr(tempDMap.intro,sizeof(DMaps[0].intro)-1,f)) |
| 4666 | { | ||
| 4667 | ✗ | return qe_invalid; | |
| 4668 | } | ||
| 4669 | |||
| 4670 |
5/8✓ Branch 0 taken 228864 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 228864 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1536 times.
✓ Branch 5 taken 227328 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1536 times.
|
228864 | if(Header && ((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<152)))) |
| 4671 | { | ||
| 4672 | ✗ | if ((tempDMap.type & dmfTYPE) == dmOVERW) tempDMap.flags = dmfCAVES | dmf3STAIR | dmfWHIRLWIND | dmfGUYCAVES; | |
| 4673 | ✗ | DMaps[index] = tempDMap; | |
| 4674 | |||
| 4675 | ✗ | return 0; | |
| 4676 | } | ||
| 4677 | |||
| 4678 |
3/4✓ Branch 0 taken 228864 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✓ Branch 3 taken 227328 times.
|
228864 | if(Header && (Header->zelda_version < 0x193)) |
| 4679 | { | ||
| 4680 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4681 | { | ||
| 4682 | ✗ | return qe_invalid; | |
| 4683 | } | ||
| 4684 | 1536 | } | |
| 4685 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 118784 times.
|
228864 | if ( s_version >= 11 ) |
| 4686 | { | ||
| 4687 |
2/4✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 110080 times.
✗ Branch 3 not taken.
|
110080 | if(!p_igetl(&tempDMap.minimap_tile[0],f)) |
| 4688 | { | ||
| 4689 | ✗ | return qe_invalid; | |
| 4690 | } | ||
| 4691 | 110080 | } | |
| 4692 | else | ||
| 4693 | { | ||
| 4694 |
2/4✓ Branch 0 taken 118784 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 118784 times.
✗ Branch 3 not taken.
|
118784 | if(!p_igetw(&tempDMap.minimap_tile[0],f)) |
| 4695 | { | ||
| 4696 | ✗ | return qe_invalid; | |
| 4697 | } | ||
| 4698 | } | ||
| 4699 | |||
| 4700 |
2/4✓ Branch 0 taken 228864 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 228864 times.
✗ Branch 3 not taken.
|
228864 | if(!p_getc(&tempDMap.minimap_cset[0],f)) |
| 4701 | { | ||
| 4702 | ✗ | return qe_invalid; | |
| 4703 | } | ||
| 4704 | |||
| 4705 |
3/4✓ Branch 0 taken 228864 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✓ Branch 3 taken 227328 times.
|
228864 | if(Header && (Header->zelda_version < 0x193)) |
| 4706 | { | ||
| 4707 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4708 | { | ||
| 4709 | ✗ | return qe_invalid; | |
| 4710 | } | ||
| 4711 | 1536 | } | |
| 4712 | |||
| 4713 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 118784 times.
|
228864 | if ( s_version >= 11 ) |
| 4714 | { | ||
| 4715 |
2/4✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 110080 times.
✗ Branch 3 not taken.
|
110080 | if(!p_igetl(&tempDMap.minimap_tile[1],f)) |
| 4716 | { | ||
| 4717 | ✗ | return qe_invalid; | |
| 4718 | } | ||
| 4719 | 110080 | } | |
| 4720 | else | ||
| 4721 | { | ||
| 4722 |
2/4✓ Branch 0 taken 118784 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 118784 times.
✗ Branch 3 not taken.
|
118784 | if(!p_igetw(&tempDMap.minimap_tile[1],f)) |
| 4723 | { | ||
| 4724 | ✗ | return qe_invalid; | |
| 4725 | } | ||
| 4726 | } | ||
| 4727 |
2/4✓ Branch 0 taken 228864 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 228864 times.
✗ Branch 3 not taken.
|
228864 | if(!p_getc(&tempDMap.minimap_cset[1],f)) |
| 4728 | { | ||
| 4729 | ✗ | return qe_invalid; | |
| 4730 | } | ||
| 4731 | |||
| 4732 |
3/4✓ Branch 0 taken 228864 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✓ Branch 3 taken 227328 times.
|
228864 | if(Header && (Header->zelda_version < 0x193)) |
| 4733 | { | ||
| 4734 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4735 | { | ||
| 4736 | ✗ | return qe_invalid; | |
| 4737 | } | ||
| 4738 | 1536 | } | |
| 4739 | |||
| 4740 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 118784 times.
|
228864 | if ( s_version >= 11 ) |
| 4741 | { | ||
| 4742 |
2/4✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 110080 times.
✗ Branch 3 not taken.
|
110080 | if(!p_igetl(&tempDMap.largemap_tile[0],f)) |
| 4743 | { | ||
| 4744 | ✗ | return qe_invalid; | |
| 4745 | } | ||
| 4746 | 110080 | } | |
| 4747 | else | ||
| 4748 | { | ||
| 4749 |
2/4✓ Branch 0 taken 118784 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 118784 times.
✗ Branch 3 not taken.
|
118784 | if(!p_igetw(&tempDMap.largemap_tile[0],f)) |
| 4750 | { | ||
| 4751 | ✗ | return qe_invalid; | |
| 4752 | } | ||
| 4753 | } | ||
| 4754 | |||
| 4755 |
2/4✓ Branch 0 taken 228864 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 228864 times.
✗ Branch 3 not taken.
|
228864 | if(!p_getc(&tempDMap.largemap_cset[0],f)) |
| 4756 | { | ||
| 4757 | ✗ | return qe_invalid; | |
| 4758 | } | ||
| 4759 | |||
| 4760 |
3/4✓ Branch 0 taken 228864 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✓ Branch 3 taken 227328 times.
|
228864 | if(Header && (Header->zelda_version < 0x193)) |
| 4761 | { | ||
| 4762 | |||
| 4763 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4764 | { | ||
| 4765 | ✗ | return qe_invalid; | |
| 4766 | } | ||
| 4767 | 1536 | } | |
| 4768 | |||
| 4769 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 118784 times.
|
228864 | if ( s_version >= 11 ) |
| 4770 | { | ||
| 4771 |
2/4✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 110080 times.
✗ Branch 3 not taken.
|
110080 | if(!p_igetl(&tempDMap.largemap_tile[1],f)) |
| 4772 | { | ||
| 4773 | ✗ | return qe_invalid; | |
| 4774 | } | ||
| 4775 | 110080 | } | |
| 4776 | else | ||
| 4777 | { | ||
| 4778 |
2/4✓ Branch 0 taken 118784 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 118784 times.
✗ Branch 3 not taken.
|
118784 | if(!p_igetw(&tempDMap.largemap_tile[1],f)) |
| 4779 | { | ||
| 4780 | ✗ | return qe_invalid; | |
| 4781 | } | ||
| 4782 | } | ||
| 4783 |
2/4✓ Branch 0 taken 228864 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 228864 times.
✗ Branch 3 not taken.
|
228864 | if(!p_getc(&tempDMap.largemap_cset[1],f)) |
| 4784 | { | ||
| 4785 | ✗ | return qe_invalid; | |
| 4786 | } | ||
| 4787 | |||
| 4788 |
2/2✓ Branch 0 taken 161280 times.
✓ Branch 1 taken 67584 times.
|
228864 | if (s_version < 25) |
| 4789 | { | ||
| 4790 | 161280 | char tmusic[57] = {0}; | |
| 4791 |
2/4✓ Branch 0 taken 161280 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 161280 times.
✗ Branch 3 not taken.
|
161280 | if(!p_getstr(tmusic,sizeof(tmusic)-1,f)) |
| 4792 | ✗ | return qe_invalid; | |
| 4793 |
1/2✓ Branch 0 taken 161280 times.
✗ Branch 1 not taken.
|
161280 | tempMusic.enhanced.path = tmusic; |
| 4794 | 161280 | } | |
| 4795 | } | ||
| 4796 | |||
| 4797 |
2/2✓ Branch 0 taken 212480 times.
✓ Branch 1 taken 16960 times.
|
229440 | if(s_version>1) |
| 4798 | { | ||
| 4799 |
2/2✓ Branch 0 taken 144896 times.
✓ Branch 1 taken 67584 times.
|
212480 | if (s_version < 25) |
| 4800 |
2/4✓ Branch 0 taken 144896 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 144896 times.
✗ Branch 3 not taken.
|
144896 | if(!p_getc(&tempMusic.enhanced.track,f)) |
| 4801 | ✗ | return qe_invalid; | |
| 4802 | |||
| 4803 |
2/4✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 212480 times.
✗ Branch 3 not taken.
|
212480 | if(!p_getc(&tempDMap.active_subscreen,f)) |
| 4804 | { | ||
| 4805 | ✗ | return qe_invalid; | |
| 4806 | } | ||
| 4807 | |||
| 4808 |
2/4✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 212480 times.
✗ Branch 3 not taken.
|
212480 | if(!p_getc(&tempDMap.passive_subscreen,f)) |
| 4809 | { | ||
| 4810 | ✗ | return qe_invalid; | |
| 4811 | } | ||
| 4812 | 212480 | } | |
| 4813 | |||
| 4814 |
2/2✓ Branch 0 taken 212480 times.
✓ Branch 1 taken 16960 times.
|
229440 | if(s_version>2) |
| 4815 | { | ||
| 4816 | byte di[32]; | ||
| 4817 | |||
| 4818 |
2/4✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 212480 times.
✗ Branch 3 not taken.
|
212480 | if(!pfread(&di, 32, f)) return qe_invalid; |
| 4819 | |||
| 4820 |
2/2✓ Branch 0 taken 54394880 times.
✓ Branch 1 taken 212480 times.
|
54607360 | for(int32_t j=0; j<MAXITEMS; j++) |
| 4821 | { | ||
| 4822 |
2/2✓ Branch 0 taken 9207 times.
✓ Branch 1 taken 54385673 times.
|
54394880 | if(di[j/8] & (1 << (j%8))) tempDMap.disableditems[j]=1; |
| 4823 | 54385673 | else tempDMap.disableditems[j]=0; | |
| 4824 | 54394880 | } | |
| 4825 | 212480 | } | |
| 4826 | |||
| 4827 |
2/2✓ Branch 0 taken 212480 times.
✓ Branch 1 taken 16960 times.
|
229440 | if(s_version >= 6) |
| 4828 | { | ||
| 4829 |
2/4✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 212480 times.
✗ Branch 3 not taken.
|
212480 | if(!p_igetl(&tempDMap.flags,f)) |
| 4830 | { | ||
| 4831 | ✗ | return qe_invalid; | |
| 4832 | } | ||
| 4833 | 212480 | } | |
| 4834 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16960 times.
|
16960 | else if(s_version>3) |
| 4835 | { | ||
| 4836 | char temp; | ||
| 4837 | |||
| 4838 | ✗ | if(!p_getc(&temp,f)) | |
| 4839 | { | ||
| 4840 | ✗ | return qe_invalid; | |
| 4841 | } | ||
| 4842 | |||
| 4843 | ✗ | tempDMap.flags = temp; | |
| 4844 | ✗ | } | |
| 4845 |
3/8✓ Branch 0 taken 8975 times.
✓ Branch 1 taken 7985 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8975 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
16960 | else if(tempDMap.level==0 && ((Header->zelda_version < 0x211) || ((Header->zelda_version == 0x211) && (Header->build<18)))) |
| 4846 | { | ||
| 4847 | 8975 | tempDMap.flags=dmfCAVES|dmf3STAIR|dmfWHIRLWIND|dmfGUYCAVES; | |
| 4848 | 8975 | } | |
| 4849 | else | ||
| 4850 | 7985 | tempDMap.flags=0; | |
| 4851 | |||
| 4852 |
2/2✓ Branch 0 taken 212480 times.
✓ Branch 1 taken 16960 times.
|
229440 | if(s_version<7) |
| 4853 | { | ||
| 4854 |
5/6✓ Branch 0 taken 8975 times.
✓ Branch 1 taken 7985 times.
✓ Branch 2 taken 8975 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6129 times.
✓ Branch 5 taken 2846 times.
|
16960 | if(tempDMap.level==0 && get_bit(deprecated_rules,14)) |
| 4855 | 6129 | tempDMap.flags|= dmfVIEWMAP; | |
| 4856 | 16960 | } | |
| 4857 | |||
| 4858 |
2/2✓ Branch 0 taken 212480 times.
✓ Branch 1 taken 16960 times.
|
229440 | if(s_version<8) |
| 4859 | { | ||
| 4860 |
4/4✓ Branch 0 taken 8975 times.
✓ Branch 1 taken 7985 times.
✓ Branch 2 taken 8050 times.
✓ Branch 3 taken 925 times.
|
16960 | if(tempDMap.level==0 && (tempDMap.type&dmfTYPE)==dmDNGN) |
| 4861 | { | ||
| 4862 |
1/2✓ Branch 0 taken 8050 times.
✗ Branch 1 not taken.
|
8050 | tempDMap.type &= ~dmDNGN; |
| 4863 | 8050 | tempDMap.type |= dmCAVE; | |
| 4864 | 8050 | } | |
| 4865 |
2/2✓ Branch 0 taken 6759 times.
✓ Branch 1 taken 2151 times.
|
8910 | else if((tempDMap.type&dmfTYPE)==dmCAVE) |
| 4866 | { | ||
| 4867 | 2151 | tempDMap.flags |= dmfMINIMAPCOLORFIX; | |
| 4868 | 2151 | } | |
| 4869 | 16960 | } | |
| 4870 | |||
| 4871 |
7/8✓ Branch 0 taken 229440 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2112 times.
✓ Branch 3 taken 227328 times.
✓ Branch 4 taken 1536 times.
✓ Branch 5 taken 576 times.
✓ Branch 6 taken 1536 times.
✓ Branch 7 taken 227328 times.
|
229440 | if(Header && ((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>=41))) |
| 4872 | 228864 | && (Header->zelda_version < 0x193)) | |
| 4873 | { | ||
| 4874 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4875 | { | ||
| 4876 | ✗ | return qe_invalid; | |
| 4877 | } | ||
| 4878 | 1536 | } | |
| 4879 | |||
| 4880 |
2/2✓ Branch 0 taken 119360 times.
✓ Branch 1 taken 110080 times.
|
229440 | if(s_version >= 10) |
| 4881 | { | ||
| 4882 |
2/4✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 110080 times.
✗ Branch 3 not taken.
|
110080 | if(!p_getc(&tempDMap.sideview,f)) |
| 4883 | { | ||
| 4884 | ✗ | return qe_invalid; | |
| 4885 | } | ||
| 4886 | 110080 | } | |
| 4887 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 119360 times.
|
229440 | if(s_version < 10) tempDMap.sideview = 0; |
| 4888 | |||
| 4889 | //Dmap Scripts | ||
| 4890 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 119360 times.
|
229440 | if(s_version >= 12) |
| 4891 | { | ||
| 4892 |
2/4✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 110080 times.
✗ Branch 3 not taken.
|
110080 | if(!p_igetw(&tempDMap.script,f)) |
| 4893 | { | ||
| 4894 | ✗ | return qe_invalid; | |
| 4895 | } | ||
| 4896 |
2/2✓ Branch 0 taken 880640 times.
✓ Branch 1 taken 110080 times.
|
990720 | for ( int32_t q = 0; q < 8; q++ ) |
| 4897 | { | ||
| 4898 |
2/4✓ Branch 0 taken 880640 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 880640 times.
✗ Branch 3 not taken.
|
880640 | if(!p_igetl(&tempDMap.initD[q],f)) |
| 4899 | { | ||
| 4900 | ✗ | return qe_invalid; | |
| 4901 | } | ||
| 4902 | 880640 | } | |
| 4903 | 110080 | } | |
| 4904 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 119360 times.
|
229440 | if ( s_version < 12 ) |
| 4905 | { | ||
| 4906 | 119360 | tempDMap.script = 0; | |
| 4907 |
2/2✓ Branch 0 taken 954880 times.
✓ Branch 1 taken 119360 times.
|
1074240 | for ( int32_t q = 0; q < 8; q++ ) |
| 4908 | { | ||
| 4909 | 954880 | tempDMap.initD[q] = 0; | |
| 4910 | 954880 | } | |
| 4911 | 119360 | } | |
| 4912 | |||
| 4913 |
2/2✓ Branch 0 taken 119360 times.
✓ Branch 1 taken 110080 times.
|
229440 | if(s_version >= 13) |
| 4914 | { | ||
| 4915 |
2/2✓ Branch 0 taken 880640 times.
✓ Branch 1 taken 110080 times.
|
990720 | for ( int32_t q = 0; q < 8; q++ ) |
| 4916 | { | ||
| 4917 |
2/2✓ Branch 0 taken 57241600 times.
✓ Branch 1 taken 880640 times.
|
58122240 | for ( int32_t w = 0; w < 65; w++ ) |
| 4918 | { | ||
| 4919 |
2/4✓ Branch 0 taken 57241600 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 57241600 times.
✗ Branch 3 not taken.
|
57241600 | if(!p_getc(&tempDMap.initD_label[q][w],f)) |
| 4920 | { | ||
| 4921 | ✗ | return qe_invalid; | |
| 4922 | } | ||
| 4923 | 57241600 | } | |
| 4924 | 880640 | } | |
| 4925 | 110080 | } | |
| 4926 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 119360 times.
|
229440 | if ( s_version < 13 ) |
| 4927 | { | ||
| 4928 | 119360 | tempDMap.script = 0; | |
| 4929 |
2/2✓ Branch 0 taken 954880 times.
✓ Branch 1 taken 119360 times.
|
1074240 | for ( int32_t q = 0; q < 8; q++ ) |
| 4930 | { | ||
| 4931 |
2/2✓ Branch 0 taken 62067200 times.
✓ Branch 1 taken 954880 times.
|
63022080 | for ( int32_t w = 0; w < 65; w++ ) |
| 4932 | 62067200 | tempDMap.initD_label[q][w] = 0; | |
| 4933 | 954880 | } | |
| 4934 | 119360 | } | |
| 4935 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 119360 times.
|
229440 | if(s_version >= 14) |
| 4936 | { | ||
| 4937 |
2/4✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 110080 times.
✗ Branch 3 not taken.
|
110080 | if(!p_igetw(&tempDMap.active_sub_script,f)) |
| 4938 | { | ||
| 4939 | ✗ | return qe_invalid; | |
| 4940 | } | ||
| 4941 |
2/4✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 110080 times.
✗ Branch 3 not taken.
|
110080 | if(!p_igetw(&tempDMap.passive_sub_script,f)) |
| 4942 | { | ||
| 4943 | ✗ | return qe_invalid; | |
| 4944 | } | ||
| 4945 |
2/2✓ Branch 0 taken 880640 times.
✓ Branch 1 taken 110080 times.
|
990720 | for ( int32_t q = 0; q < 8; ++q ) |
| 4946 | { | ||
| 4947 |
2/4✓ Branch 0 taken 880640 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 880640 times.
✗ Branch 3 not taken.
|
880640 | if(!p_igetl(&tempDMap.sub_initD[q],f)) |
| 4948 | { | ||
| 4949 | ✗ | return qe_invalid; | |
| 4950 | } | ||
| 4951 | 880640 | } | |
| 4952 |
2/2✓ Branch 0 taken 880640 times.
✓ Branch 1 taken 110080 times.
|
990720 | for(int32_t q = 0; q < 8; ++q) |
| 4953 | { | ||
| 4954 |
2/2✓ Branch 0 taken 57241600 times.
✓ Branch 1 taken 880640 times.
|
58122240 | for ( int32_t w = 0; w < 65; ++w ) |
| 4955 | { | ||
| 4956 |
2/4✓ Branch 0 taken 57241600 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 57241600 times.
✗ Branch 3 not taken.
|
57241600 | if(!p_getc(&tempDMap.sub_initD_label[q][w],f)) |
| 4957 | { | ||
| 4958 | ✗ | return qe_invalid; | |
| 4959 | } | ||
| 4960 | 57241600 | } | |
| 4961 | 880640 | } | |
| 4962 | 110080 | } | |
| 4963 | else | ||
| 4964 | { | ||
| 4965 | 119360 | tempDMap.active_sub_script = 0; | |
| 4966 | 119360 | tempDMap.passive_sub_script = 0; | |
| 4967 |
2/2✓ Branch 0 taken 954880 times.
✓ Branch 1 taken 119360 times.
|
1074240 | for(int32_t q = 0; q < 8; ++q) |
| 4968 | { | ||
| 4969 | 954880 | tempDMap.sub_initD[q] = 0; | |
| 4970 |
2/2✓ Branch 0 taken 62067200 times.
✓ Branch 1 taken 954880 times.
|
63022080 | for(int32_t w = 0; w < 65; ++w) |
| 4971 | 62067200 | tempDMap.sub_initD_label[q][w] = 0; | |
| 4972 | 954880 | } | |
| 4973 | } | ||
| 4974 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 119360 times.
|
229440 | if(s_version >= 15) |
| 4975 | { | ||
| 4976 |
2/4✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 110080 times.
✗ Branch 3 not taken.
|
110080 | if(!p_igetw(&tempDMap.onmap_script,f)) |
| 4977 | { | ||
| 4978 | ✗ | return qe_invalid; | |
| 4979 | } | ||
| 4980 |
2/2✓ Branch 0 taken 880640 times.
✓ Branch 1 taken 110080 times.
|
990720 | for ( int32_t q = 0; q < 8; ++q ) |
| 4981 | { | ||
| 4982 |
2/4✓ Branch 0 taken 880640 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 880640 times.
✗ Branch 3 not taken.
|
880640 | if(!p_igetl(&tempDMap.onmap_initD[q],f)) |
| 4983 | { | ||
| 4984 | ✗ | return qe_invalid; | |
| 4985 | } | ||
| 4986 | 880640 | } | |
| 4987 |
2/2✓ Branch 0 taken 880640 times.
✓ Branch 1 taken 110080 times.
|
990720 | for(int32_t q = 0; q < 8; ++q) |
| 4988 | { | ||
| 4989 |
2/2✓ Branch 0 taken 57241600 times.
✓ Branch 1 taken 880640 times.
|
58122240 | for ( int32_t w = 0; w < 65; ++w ) |
| 4990 | { | ||
| 4991 |
2/4✓ Branch 0 taken 57241600 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 57241600 times.
✗ Branch 3 not taken.
|
57241600 | if(!p_getc(&tempDMap.onmap_initD_label[q][w],f)) |
| 4992 | { | ||
| 4993 | ✗ | return qe_invalid; | |
| 4994 | } | ||
| 4995 | 57241600 | } | |
| 4996 | 880640 | } | |
| 4997 | 110080 | } | |
| 4998 | else | ||
| 4999 | { | ||
| 5000 | 119360 | tempDMap.onmap_script = 0; | |
| 5001 |
2/2✓ Branch 0 taken 954880 times.
✓ Branch 1 taken 119360 times.
|
1074240 | for(int32_t q = 0; q < 8; ++q) |
| 5002 | { | ||
| 5003 | 954880 | tempDMap.onmap_initD[q] = 0; | |
| 5004 |
2/2✓ Branch 0 taken 62067200 times.
✓ Branch 1 taken 954880 times.
|
63022080 | for(int32_t w = 0; w < 65; ++w) |
| 5005 | { | ||
| 5006 | 62067200 | tempDMap.onmap_initD_label[q][w] = 0; | |
| 5007 | 62067200 | } | |
| 5008 | 954880 | } | |
| 5009 | } | ||
| 5010 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 119360 times.
|
229440 | if(s_version >= 16) |
| 5011 | { | ||
| 5012 |
2/4✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 110080 times.
✗ Branch 3 not taken.
|
110080 | if(!p_igetw(&tempDMap.mirrorDMap,f)) |
| 5013 | { | ||
| 5014 | ✗ | return qe_invalid; | |
| 5015 | } | ||
| 5016 | 110080 | } | |
| 5017 | else | ||
| 5018 | { | ||
| 5019 | 119360 | tempDMap.mirrorDMap = -1; | |
| 5020 | } | ||
| 5021 | |||
| 5022 | // Enhanced music loop points | ||
| 5023 |
4/4✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 128064 times.
✓ Branch 2 taken 33792 times.
✓ Branch 3 taken 67584 times.
|
229440 | if (s_version >= 18 && s_version < 25) |
| 5024 | { | ||
| 5025 |
2/4✓ Branch 0 taken 33792 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 33792 times.
✗ Branch 3 not taken.
|
33792 | if (!p_igetl(&tempMusic.enhanced.loop_start, f)) |
| 5026 | ✗ | return qe_invalid; | |
| 5027 |
2/4✓ Branch 0 taken 33792 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 33792 times.
✗ Branch 3 not taken.
|
33792 | if (!p_igetl(&tempMusic.enhanced.loop_end, f)) |
| 5028 | ✗ | return qe_invalid; | |
| 5029 |
2/4✓ Branch 0 taken 33792 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 33792 times.
✗ Branch 3 not taken.
|
33792 | if (!p_igetl(&tempMusic.enhanced.xfade_in, f)) |
| 5030 | ✗ | return qe_invalid; | |
| 5031 |
2/4✓ Branch 0 taken 33792 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 33792 times.
✗ Branch 3 not taken.
|
33792 | if (!p_igetl(&tempMusic.enhanced.xfade_out, f)) |
| 5032 | ✗ | return qe_invalid; | |
| 5033 | 33792 | } | |
| 5034 | |||
| 5035 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 128064 times.
|
229440 | if(s_version >= 19) |
| 5036 |
2/4✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 101376 times.
✗ Branch 3 not taken.
|
101376 | if(!p_getc(&tempDMap.overlay_subscreen, f)) |
| 5037 | ✗ | return qe_invalid; | |
| 5038 | |||
| 5039 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 128064 times.
|
229440 | if (s_version >= 20) |
| 5040 | { | ||
| 5041 |
2/4✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 101376 times.
✗ Branch 3 not taken.
|
101376 | if (!p_igetl(&tempDMap.intro_string_id, f)) |
| 5042 | ✗ | return qe_invalid; | |
| 5043 | 101376 | } | |
| 5044 | else | ||
| 5045 | 128064 | tempDMap.intro_string_id = 0; | |
| 5046 | |||
| 5047 |
2/2✓ Branch 0 taken 214592 times.
✓ Branch 1 taken 14848 times.
|
229440 | if(s_version == 21) |
| 5048 | { | ||
| 5049 | static regions_data tmp_rd; | ||
| 5050 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14848 times.
|
14848 | regions_data& rd = should_skip ? tmp_rd : Regions[tempDMap.map]; |
| 5051 |
2/2✓ Branch 0 taken 118784 times.
✓ Branch 1 taken 14848 times.
|
133632 | for(int32_t j=0; j<8; j++) |
| 5052 | { | ||
| 5053 |
2/2✓ Branch 0 taken 950272 times.
✓ Branch 1 taken 118784 times.
|
1069056 | for(int32_t k=0; k<8; k++) |
| 5054 | { | ||
| 5055 |
2/4✓ Branch 0 taken 950272 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 950272 times.
✗ Branch 3 not taken.
|
950272 | if(!p_getc(&rd.region_ids[j][k],f)) |
| 5056 | { | ||
| 5057 | ✗ | return qe_invalid; | |
| 5058 | } | ||
| 5059 | 950272 | } | |
| 5060 | 118784 | } | |
| 5061 | 14848 | } | |
| 5062 | |||
| 5063 |
3/4✓ Branch 0 taken 78336 times.
✓ Branch 1 taken 151104 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 78336 times.
|
229440 | if (s_version > 22 && (tempDMap.flags & dmfCUSTOM_GRAVITY)) |
| 5064 | { | ||
| 5065 | ✗ | if (!p_igetzf(&tempDMap.dmap_gravity, f)) | |
| 5066 | ✗ | return qe_invalid; | |
| 5067 | ✗ | if (!p_igetzf(&tempDMap.dmap_terminal_v, f)) | |
| 5068 | ✗ | return qe_invalid; | |
| 5069 | ✗ | } | |
| 5070 |
2/2✓ Branch 0 taken 68096 times.
✓ Branch 1 taken 161344 times.
|
229440 | if(s_version > 23) |
| 5071 | { | ||
| 5072 |
2/4✓ Branch 0 taken 68096 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 68096 times.
✗ Branch 3 not taken.
|
68096 | if(!p_igetw(&tempDMap.map_subscreen, f)) |
| 5073 | ✗ | return qe_invalid; | |
| 5074 |
2/4✓ Branch 0 taken 68096 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 68096 times.
✗ Branch 3 not taken.
|
68096 | if(!p_getc(&tempDMap.floor, f)) |
| 5075 | ✗ | return qe_invalid; | |
| 5076 | 68096 | } | |
| 5077 |
2/2✓ Branch 0 taken 67584 times.
✓ Branch 1 taken 161856 times.
|
229440 | if (s_version >= 25) |
| 5078 | { | ||
| 5079 |
2/4✓ Branch 0 taken 67584 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 67584 times.
✗ Branch 3 not taken.
|
67584 | if (!p_igetw(&tempDMap.music, f)) |
| 5080 | ✗ | return qe_invalid; | |
| 5081 | 67584 | } | |
| 5082 |
2/2✓ Branch 0 taken 161600 times.
✓ Branch 1 taken 256 times.
|
161856 | else if (!should_skip) // add an AdvancedMusic to the quest |
| 5083 | { | ||
| 5084 |
3/4✓ Branch 0 taken 161600 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19029 times.
✓ Branch 3 taken 142571 times.
|
161600 | if (tempMusic.is_empty()) |
| 5085 | 142571 | tempDMap.music = 0; | |
| 5086 | else | ||
| 5087 | { | ||
| 5088 |
1/2✓ Branch 0 taken 19029 times.
✗ Branch 1 not taken.
|
19029 | tempMusic.name = fmt::format("DMap {}", index); |
| 5089 |
1/2✓ Branch 0 taken 19029 times.
✗ Branch 1 not taken.
|
19029 | auto& ref = quest_music.emplace_back(tempMusic); |
| 5090 | 19029 | tempDMap.music = word(quest_music.size()); | |
| 5091 | 19029 | ref.id = tempDMap.music; | |
| 5092 | } | ||
| 5093 | 161600 | } | |
| 5094 | |||
| 5095 |
2/2✓ Branch 0 taken 229184 times.
✓ Branch 1 taken 256 times.
|
229440 | if (!should_skip) |
| 5096 | { | ||
| 5097 |
1/2✓ Branch 0 taken 229184 times.
✗ Branch 1 not taken.
|
229184 | if(loading_tileset_flags & TILESET_CLEARMAPS) |
| 5098 | ✗ | tempDMap.map = 0; | |
| 5099 |
1/2✓ Branch 0 taken 229184 times.
✗ Branch 1 not taken.
|
229184 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 5100 | { | ||
| 5101 | ✗ | tempDMap.script = 0; | |
| 5102 | ✗ | for(int q = 0; q < 8; ++q) | |
| 5103 | ✗ | tempDMap.initD[q] = 0; | |
| 5104 | ✗ | } | |
| 5105 |
1/2✓ Branch 0 taken 229184 times.
✗ Branch 1 not taken.
|
229184 | DMaps[index] = tempDMap; |
| 5106 | 229184 | } | |
| 5107 | } | ||
| 5108 | 229440 | return 0; | |
| 5109 | 235584 | } | |
| 5110 | 497 | int32_t readdmaps(PACKFILE *f, zquestheader *Header, word, word, word start_dmap, word max_dmaps) | |
| 5111 | { | ||
| 5112 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 24 times.
|
497 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_dmaps); |
| 5113 | |||
| 5114 | 497 | word dmapstoread=0; | |
| 5115 | |||
| 5116 | int32_t dummy; | ||
| 5117 | 497 | word s_version=0; | |
| 5118 | |||
| 5119 |
3/4✓ Branch 0 taken 496 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 496 times.
✗ Branch 3 not taken.
|
497 | if (!should_skip && s_version == 21) |
| 5120 | ✗ | Regions = {}; | |
| 5121 | |||
| 5122 | 497 | Header->is_z3 = false; | |
| 5123 |
3/4✓ Branch 0 taken 497 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 473 times.
✓ Branch 3 taken 24 times.
|
497 | if(!Header || Header->zelda_version > 0x192) |
| 5124 | { | ||
| 5125 | //section version info | ||
| 5126 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetw(&s_version,f)) |
| 5127 | { | ||
| 5128 | ✗ | return qe_invalid; | |
| 5129 | } | ||
| 5130 | |||
| 5131 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if (s_version > V_DMAPS) |
| 5132 | ✗ | return qe_version; | |
| 5133 | |||
| 5134 | 473 | Header->is_z3 = s_version >= 22; | |
| 5135 | 473 | FFCore.quest_format[vDMaps] = s_version; | |
| 5136 | |||
| 5137 | |||
| 5138 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!read_deprecated_section_cversion(f)) |
| 5139 | { | ||
| 5140 | ✗ | return qe_invalid; | |
| 5141 | } | ||
| 5142 | |||
| 5143 | //section size | ||
| 5144 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetl(&dummy,f)) |
| 5145 | { | ||
| 5146 | ✗ | return qe_invalid; | |
| 5147 | } | ||
| 5148 | |||
| 5149 | //finally... section data | ||
| 5150 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if(!p_igetw(&dmapstoread,f)) |
| 5151 | { | ||
| 5152 | ✗ | return qe_invalid; | |
| 5153 | } | ||
| 5154 | 473 | } | |
| 5155 | else | ||
| 5156 | { | ||
| 5157 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
30 | if((Header->zelda_version < 0x192)|| |
| 5158 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((Header->zelda_version == 0x192)&&(Header->build<5))) |
| 5159 | { | ||
| 5160 | 18 | dmapstoread=32; | |
| 5161 | 18 | } | |
| 5162 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | else if(s_version <= 4) |
| 5163 | { | ||
| 5164 | 6 | dmapstoread=OLDMAXDMAPS; | |
| 5165 | 6 | } | |
| 5166 | else | ||
| 5167 | { | ||
| 5168 | ✗ | dmapstoread=MAXDMAPS; | |
| 5169 | } | ||
| 5170 | } | ||
| 5171 | |||
| 5172 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 415 times.
|
497 | dmapstoread = zc_min(dmapstoread, max_dmaps); |
| 5173 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 415 times.
|
497 | dmapstoread = zc_min(dmapstoread, MAXDMAPS-start_dmap); |
| 5174 | |||
| 5175 |
2/2✓ Branch 0 taken 132 times.
✓ Branch 1 taken 365 times.
|
497 | if (s_version < 25) // reserve space for the advanced music that will be created |
| 5176 | 365 | quest_music.reserve(quest_music.size() + dmapstoread); | |
| 5177 | |||
| 5178 |
2/2✓ Branch 0 taken 229440 times.
✓ Branch 1 taken 497 times.
|
229937 | for(int i = start_dmap; i < dmapstoread + start_dmap; ++i) |
| 5179 | { | ||
| 5180 |
1/2✓ Branch 0 taken 229440 times.
✗ Branch 1 not taken.
|
229440 | if (int ret = read_one_dmap(f, Header, s_version, i)) |
| 5181 | ✗ | return ret; | |
| 5182 | 229440 | } | |
| 5183 | |||
| 5184 | 497 | return 0; | |
| 5185 | 497 | } | |
| 5186 | |||
| 5187 | 415 | int32_t readmisccolors(PACKFILE *f, zquestheader *Header, miscQdata *Misc) | |
| 5188 | { | ||
| 5189 | //these are here to bypass compiler warnings about unused arguments | ||
| 5190 | 415 | Header=Header; | |
| 5191 | |||
| 5192 | 415 | miscQdata temp_misc; | |
| 5193 | 415 | word s_version=0; | |
| 5194 | 415 | int32_t tempsize=0; | |
| 5195 | word dummyw; | ||
| 5196 | |||
| 5197 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | temp_misc = *Misc; |
| 5198 | |||
| 5199 | //section version info | ||
| 5200 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_igetw(&s_version,f)) |
| 5201 | { | ||
| 5202 | ✗ | return qe_invalid; | |
| 5203 | } | ||
| 5204 | |||
| 5205 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if (s_version > V_COLORS) |
| 5206 | ✗ | return qe_version; | |
| 5207 | |||
| 5208 | 415 | FFCore.quest_format[vColours] = s_version; | |
| 5209 | |||
| 5210 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | al_trace("Misc Colours section version: %d\n", s_version); |
| 5211 | |||
| 5212 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!read_deprecated_section_cversion(f)) |
| 5213 | { | ||
| 5214 | ✗ | return qe_invalid; | |
| 5215 | } | ||
| 5216 | |||
| 5217 | |||
| 5218 | //section size | ||
| 5219 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_igetl(&tempsize,f)) |
| 5220 | { | ||
| 5221 | ✗ | return qe_invalid; | |
| 5222 | } | ||
| 5223 | |||
| 5224 | //finally... section data | ||
| 5225 | 415 | readsize=0; | |
| 5226 | |||
| 5227 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.text,f)) |
| 5228 | { | ||
| 5229 | ✗ | return qe_invalid; | |
| 5230 | } | ||
| 5231 | |||
| 5232 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.caption,f)) |
| 5233 | { | ||
| 5234 | ✗ | return qe_invalid; | |
| 5235 | } | ||
| 5236 | |||
| 5237 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.overw_bg,f)) |
| 5238 | { | ||
| 5239 | ✗ | return qe_invalid; | |
| 5240 | } | ||
| 5241 | |||
| 5242 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.dngn_bg,f)) |
| 5243 | { | ||
| 5244 | ✗ | return qe_invalid; | |
| 5245 | } | ||
| 5246 | |||
| 5247 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.dngn_fg,f)) |
| 5248 | { | ||
| 5249 | ✗ | return qe_invalid; | |
| 5250 | } | ||
| 5251 | |||
| 5252 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.cave_fg,f)) |
| 5253 | { | ||
| 5254 | ✗ | return qe_invalid; | |
| 5255 | } | ||
| 5256 | |||
| 5257 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.bs_dk,f)) |
| 5258 | { | ||
| 5259 | ✗ | return qe_invalid; | |
| 5260 | } | ||
| 5261 | |||
| 5262 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.bs_goal,f)) |
| 5263 | { | ||
| 5264 | ✗ | return qe_invalid; | |
| 5265 | } | ||
| 5266 | |||
| 5267 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.compass_lt,f)) |
| 5268 | { | ||
| 5269 | ✗ | return qe_invalid; | |
| 5270 | } | ||
| 5271 | |||
| 5272 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.compass_dk,f)) |
| 5273 | { | ||
| 5274 | ✗ | return qe_invalid; | |
| 5275 | } | ||
| 5276 | |||
| 5277 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.subscr_bg,f)) |
| 5278 | { | ||
| 5279 | ✗ | return qe_invalid; | |
| 5280 | } | ||
| 5281 | |||
| 5282 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.triframe_color,f)) |
| 5283 | { | ||
| 5284 | ✗ | return qe_invalid; | |
| 5285 | } | ||
| 5286 | |||
| 5287 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.hero_dot,f)) |
| 5288 | { | ||
| 5289 | ✗ | return qe_invalid; | |
| 5290 | } | ||
| 5291 | |||
| 5292 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.bmap_bg,f)) |
| 5293 | { | ||
| 5294 | ✗ | return qe_invalid; | |
| 5295 | } | ||
| 5296 | |||
| 5297 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.bmap_fg,f)) |
| 5298 | { | ||
| 5299 | ✗ | return qe_invalid; | |
| 5300 | } | ||
| 5301 | |||
| 5302 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.triforce_cset,f)) |
| 5303 | { | ||
| 5304 | ✗ | return qe_invalid; | |
| 5305 | } | ||
| 5306 | |||
| 5307 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.triframe_cset,f)) |
| 5308 | { | ||
| 5309 | ✗ | return qe_invalid; | |
| 5310 | } | ||
| 5311 | |||
| 5312 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.overworld_map_cset,f)) |
| 5313 | { | ||
| 5314 | ✗ | return qe_invalid; | |
| 5315 | } | ||
| 5316 | |||
| 5317 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.dungeon_map_cset,f)) |
| 5318 | { | ||
| 5319 | ✗ | return qe_invalid; | |
| 5320 | } | ||
| 5321 | |||
| 5322 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.blueframe_cset,f)) |
| 5323 | { | ||
| 5324 | ✗ | return qe_invalid; | |
| 5325 | } | ||
| 5326 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 215 times.
|
415 | if(s_version < 4) |
| 5327 | { | ||
| 5328 |
2/4✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 200 times.
✗ Branch 3 not taken.
|
200 | if(!p_igetw(&dummyw,f)) |
| 5329 | ✗ | return qe_invalid; | |
| 5330 | 200 | temp_misc.colors.triforce_tile = dummyw; | |
| 5331 | |||
| 5332 |
2/4✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 200 times.
✗ Branch 3 not taken.
|
200 | if(!p_igetw(&dummyw,f)) |
| 5333 | ✗ | return qe_invalid; | |
| 5334 | 200 | temp_misc.colors.triframe_tile = dummyw; | |
| 5335 | |||
| 5336 |
2/4✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 200 times.
✗ Branch 3 not taken.
|
200 | if(!p_igetw(&dummyw,f)) |
| 5337 | ✗ | return qe_invalid; | |
| 5338 | 200 | temp_misc.colors.overworld_map_tile = dummyw; | |
| 5339 | |||
| 5340 |
2/4✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 200 times.
✗ Branch 3 not taken.
|
200 | if(!p_igetw(&dummyw,f)) |
| 5341 | ✗ | return qe_invalid; | |
| 5342 | 200 | temp_misc.colors.dungeon_map_tile = dummyw; | |
| 5343 | |||
| 5344 |
2/4✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 200 times.
✗ Branch 3 not taken.
|
200 | if(!p_igetw(&dummyw,f)) |
| 5345 | ✗ | return qe_invalid; | |
| 5346 | 200 | temp_misc.colors.blueframe_tile = dummyw; | |
| 5347 | |||
| 5348 |
2/4✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 200 times.
✗ Branch 3 not taken.
|
200 | if(!p_igetw(&dummyw,f)) |
| 5349 | ✗ | return qe_invalid; | |
| 5350 | 200 | temp_misc.colors.HCpieces_tile = dummyw; | |
| 5351 | 200 | } | |
| 5352 | |||
| 5353 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.HCpieces_cset,f)) |
| 5354 | { | ||
| 5355 | ✗ | return qe_invalid; | |
| 5356 | } | ||
| 5357 | |||
| 5358 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.subscr_shadow,f)) |
| 5359 | { | ||
| 5360 | ✗ | return qe_invalid; | |
| 5361 | } | ||
| 5362 | |||
| 5363 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(s_version < 2) |
| 5364 | { | ||
| 5365 | ✗ | temp_misc.colors.msgtext = 0x01; | |
| 5366 | ✗ | } | |
| 5367 | else | ||
| 5368 | { | ||
| 5369 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_getc(&temp_misc.colors.msgtext, f)) |
| 5370 | { | ||
| 5371 | ✗ | return qe_invalid; | |
| 5372 | } | ||
| 5373 | } | ||
| 5374 | |||
| 5375 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 200 times.
|
415 | if ( s_version >= 3 ) //expanded tile pages to 825 |
| 5376 | { | ||
| 5377 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&temp_misc.colors.triforce_tile,f)) |
| 5378 | { | ||
| 5379 | ✗ | return qe_invalid; | |
| 5380 | } | ||
| 5381 | |||
| 5382 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&temp_misc.colors.triframe_tile,f)) |
| 5383 | { | ||
| 5384 | ✗ | return qe_invalid; | |
| 5385 | } | ||
| 5386 | |||
| 5387 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&temp_misc.colors.overworld_map_tile,f)) |
| 5388 | { | ||
| 5389 | ✗ | return qe_invalid; | |
| 5390 | } | ||
| 5391 | |||
| 5392 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&temp_misc.colors.dungeon_map_tile,f)) |
| 5393 | { | ||
| 5394 | ✗ | return qe_invalid; | |
| 5395 | } | ||
| 5396 | |||
| 5397 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&temp_misc.colors.blueframe_tile,f)) |
| 5398 | { | ||
| 5399 | ✗ | return qe_invalid; | |
| 5400 | } | ||
| 5401 | |||
| 5402 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&temp_misc.colors.HCpieces_tile,f)) |
| 5403 | { | ||
| 5404 | ✗ | return qe_invalid; | |
| 5405 | } | ||
| 5406 | 215 | } | |
| 5407 | |||
| 5408 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | *Misc = temp_misc; |
| 5409 | |||
| 5410 | 415 | return 0; | |
| 5411 | 415 | } | |
| 5412 | |||
| 5413 | 415 | int32_t readgameicons(PACKFILE *f, zquestheader *, miscQdata *Misc) | |
| 5414 | { | ||
| 5415 | 415 | miscQdata temp_misc; | |
| 5416 | 415 | word s_version=0; | |
| 5417 | byte icons; | ||
| 5418 | 415 | int32_t tempsize=0; | |
| 5419 | |||
| 5420 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | temp_misc = *Misc; |
| 5421 | |||
| 5422 | //section version info | ||
| 5423 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_igetw(&s_version,f)) |
| 5424 | { | ||
| 5425 | ✗ | return qe_invalid; | |
| 5426 | } | ||
| 5427 | |||
| 5428 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if (s_version > V_ICONS) |
| 5429 | ✗ | return qe_version; | |
| 5430 | |||
| 5431 | 415 | FFCore.quest_format[vIcons] = s_version; | |
| 5432 | |||
| 5433 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!read_deprecated_section_cversion(f)) |
| 5434 | { | ||
| 5435 | ✗ | return qe_invalid; | |
| 5436 | } | ||
| 5437 | |||
| 5438 | |||
| 5439 | //section size | ||
| 5440 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
✗ Branch 3 not taken.
|
415 | if(!p_igetl(&tempsize,f)) |
| 5441 | { | ||
| 5442 | ✗ | return qe_invalid; | |
| 5443 | } | ||
| 5444 | |||
| 5445 | //finally... section data | ||
| 5446 | 415 | readsize=0; | |
| 5447 | |||
| 5448 | 415 | icons=4; | |
| 5449 | |||
| 5450 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 200 times.
|
415 | if ( s_version >= 10 ) |
| 5451 | { | ||
| 5452 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t i=0; i<icons; i++) |
| 5453 | { | ||
| 5454 |
2/4✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 860 times.
✗ Branch 3 not taken.
|
860 | if(!p_igetl(&temp_misc.icons[i],f)) |
| 5455 | { | ||
| 5456 | ✗ | return qe_invalid; | |
| 5457 | } | ||
| 5458 | 860 | } | |
| 5459 | 215 | } | |
| 5460 | else | ||
| 5461 | { | ||
| 5462 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<icons; i++) |
| 5463 | { | ||
| 5464 |
2/4✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 800 times.
✗ Branch 3 not taken.
|
800 | if(!p_igetw(&temp_misc.icons[i],f)) |
| 5465 | { | ||
| 5466 | ✗ | return qe_invalid; | |
| 5467 | } | ||
| 5468 | 800 | } | |
| 5469 | } | ||
| 5470 | |||
| 5471 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | *Misc = temp_misc; |
| 5472 | |||
| 5473 | 415 | return 0; | |
| 5474 | 415 | } | |
| 5475 | |||
| 5476 | 1418 | int32_t readmisc(PACKFILE *f, zquestheader *Header, miscQdata *Misc) | |
| 5477 | { | ||
| 5478 |
2/2✓ Branch 0 taken 1394 times.
✓ Branch 1 taken 24 times.
|
1418 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_misc); |
| 5479 | |||
| 5480 | 1418 | word maxinfos=256; | |
| 5481 | 1418 | word maxshops=256; | |
| 5482 | 1418 | word shops=16, infos=16, warprings=8, palcycles=256, windwarps=9, triforces=8, icons=4; | |
| 5483 | 1418 | word ponds=16, pondsize=72, expansionsize=98*2; | |
| 5484 | byte tempbyte, padding; | ||
| 5485 | 1418 | miscQdata temp_misc; | |
| 5486 | 1418 | word s_version=0; | |
| 5487 | word swaptmp; | ||
| 5488 | 1418 | int32_t tempsize=0; | |
| 5489 | |||
| 5490 |
2/2✓ Branch 0 taken 830 times.
✓ Branch 1 taken 588 times.
|
1418 | temp_misc = *Misc; |
| 5491 | |||
| 5492 |
2/2✓ Branch 0 taken 212480 times.
✓ Branch 1 taken 830 times.
|
213310 | for(int32_t i=0; i<maxshops; ++i) |
| 5493 | { | ||
| 5494 | 212480 | memset(&temp_misc.shop, 0, sizeof(shoptype)*256); | |
| 5495 | 212480 | } | |
| 5496 | |||
| 5497 |
2/2✓ Branch 0 taken 212480 times.
✓ Branch 1 taken 830 times.
|
213310 | for(int32_t i=0; i<maxinfos; ++i) |
| 5498 | { | ||
| 5499 | 212480 | memset(&temp_misc.info, 0, sizeof(infotype)*256); | |
| 5500 | 212480 | } | |
| 5501 | |||
| 5502 | 830 | memset(&temp_misc.warp, 0, sizeof(temp_misc.warp)); | |
| 5503 |
2/2✓ Branch 0 taken 26560 times.
✓ Branch 1 taken 830 times.
|
27390 | for (auto& sm : temp_misc.save_menus) |
| 5504 |
1/2✓ Branch 0 taken 26560 times.
✗ Branch 1 not taken.
|
26560 | sm.clear(); |
| 5505 | |||
| 5506 |
2/2✓ Branch 0 taken 806 times.
✓ Branch 1 taken 24 times.
|
830 | if(Header->zelda_version > 0x192) |
| 5507 | { | ||
| 5508 | //section version info | ||
| 5509 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_igetw(&s_version,f)) |
| 5510 | { | ||
| 5511 | ✗ | return qe_invalid; | |
| 5512 | } | ||
| 5513 | |||
| 5514 |
1/2✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
|
806 | if (s_version > V_MISC) |
| 5515 | ✗ | return qe_version; | |
| 5516 | |||
| 5517 | 806 | FFCore.quest_format[vMisc] = s_version; | |
| 5518 | |||
| 5519 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!read_deprecated_section_cversion(f)) |
| 5520 | { | ||
| 5521 | ✗ | return qe_invalid; | |
| 5522 | } | ||
| 5523 | |||
| 5524 | |||
| 5525 | //section size | ||
| 5526 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_igetl(&tempsize,f)) |
| 5527 | { | ||
| 5528 | ✗ | return qe_invalid; | |
| 5529 | } | ||
| 5530 | 806 | } | |
| 5531 | |||
| 5532 | //finally... section data | ||
| 5533 | 830 | readsize=0; | |
| 5534 | |||
| 5535 | //shops | ||
| 5536 |
2/2✓ Branch 0 taken 806 times.
✓ Branch 1 taken 24 times.
|
830 | if(Header->zelda_version > 0x192) |
| 5537 | { | ||
| 5538 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_igetw(&shops,f)) |
| 5539 | { | ||
| 5540 | ✗ | return qe_invalid; | |
| 5541 | } | ||
| 5542 | 806 | } | |
| 5543 | |||
| 5544 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 830 times.
|
830 | if (shops > NUM_SHOPS) |
| 5545 | { | ||
| 5546 | ✗ | return qe_invalid; | |
| 5547 | } | ||
| 5548 | |||
| 5549 |
2/2✓ Branch 0 taken 11359 times.
✓ Branch 1 taken 830 times.
|
12189 | for(int32_t i=0; i<shops; i++) |
| 5550 | { | ||
| 5551 |
2/2✓ Branch 0 taken 10174 times.
✓ Branch 1 taken 1185 times.
|
11359 | if(s_version > 6) |
| 5552 | { | ||
| 5553 |
2/4✓ Branch 0 taken 10174 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 10174 times.
|
10174 | if(!p_getstr(temp_misc.shop[i].name,sizeof(temp_misc.shop[i].name)-1,f)) |
| 5554 | { | ||
| 5555 | ✗ | return qe_invalid; | |
| 5556 | } | ||
| 5557 | 10174 | } | |
| 5558 | |||
| 5559 |
2/2✓ Branch 0 taken 34077 times.
✓ Branch 1 taken 11359 times.
|
45436 | for(int32_t j=0; j<3; j++) |
| 5560 | { | ||
| 5561 |
2/4✓ Branch 0 taken 34077 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 34077 times.
|
34077 | if(!p_getc(&temp_misc.shop[i].item[j],f)) |
| 5562 | { | ||
| 5563 | ✗ | return qe_invalid; | |
| 5564 | } | ||
| 5565 | |||
| 5566 |
2/2✓ Branch 0 taken 30522 times.
✓ Branch 1 taken 3555 times.
|
34077 | if(s_version < 4) |
| 5567 | { | ||
| 5568 | 3555 | temp_misc.shop[i].hasitem[j] = (temp_misc.shop[i].item[j] == 0) ? 0 : 1; | |
| 5569 | 3555 | } | |
| 5570 | 34077 | } | |
| 5571 | |||
| 5572 |
2/2✓ Branch 0 taken 384 times.
✓ Branch 1 taken 10975 times.
|
11359 | if(Header->zelda_version < 0x193) |
| 5573 | { | ||
| 5574 |
2/4✓ Branch 0 taken 384 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 384 times.
✗ Branch 3 not taken.
|
384 | if(!p_getc(&tempbyte,f)) |
| 5575 | { | ||
| 5576 | ✗ | return qe_invalid; | |
| 5577 | } | ||
| 5578 | 384 | } | |
| 5579 | |||
| 5580 |
2/2✓ Branch 0 taken 34077 times.
✓ Branch 1 taken 11359 times.
|
45436 | for(int32_t j=0; j<3; j++) |
| 5581 | { | ||
| 5582 |
2/4✓ Branch 0 taken 34077 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 34077 times.
|
34077 | if(!p_igetw(&temp_misc.shop[i].price[j],f)) |
| 5583 | { | ||
| 5584 | ✗ | return qe_invalid; | |
| 5585 | } | ||
| 5586 | 34077 | } | |
| 5587 | |||
| 5588 |
2/2✓ Branch 0 taken 1185 times.
✓ Branch 1 taken 10174 times.
|
11359 | if(s_version > 3) |
| 5589 | { | ||
| 5590 |
2/2✓ Branch 0 taken 30522 times.
✓ Branch 1 taken 10174 times.
|
40696 | for(int32_t j=0; j<3; j++) |
| 5591 | { | ||
| 5592 |
2/4✓ Branch 0 taken 30522 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 30522 times.
✗ Branch 3 not taken.
|
30522 | if(!p_getc(&temp_misc.shop[i].hasitem[j],f)) |
| 5593 | ✗ | return qe_invalid; | |
| 5594 | 30522 | } | |
| 5595 | 10174 | } | |
| 5596 | |||
| 5597 | /* | ||
| 5598 | if(s_version < 8) | ||
| 5599 | { | ||
| 5600 | for(int32_t j=0; j<3; j++) | ||
| 5601 | { | ||
| 5602 | (&temp_misc.shop[i].str[j])=0; //initialise. | ||
| 5603 | } | ||
| 5604 | } | ||
| 5605 | */ | ||
| 5606 | 11359 | } | |
| 5607 | |||
| 5608 | //filter all the 0 items to the end (yeah, bubble sort; sue me) | ||
| 5609 |
2/2✓ Branch 0 taken 212480 times.
✓ Branch 1 taken 830 times.
|
213310 | for(int32_t i=0; i<maxshops; ++i) |
| 5610 | { | ||
| 5611 |
2/2✓ Branch 0 taken 424960 times.
✓ Branch 1 taken 212480 times.
|
637440 | for(int32_t j=0; j<3-1; j++) |
| 5612 | { | ||
| 5613 |
2/2✓ Branch 0 taken 637440 times.
✓ Branch 1 taken 424960 times.
|
1062400 | for(int32_t k=0; k<2-j; k++) |
| 5614 | { | ||
| 5615 |
2/2✓ Branch 0 taken 24432 times.
✓ Branch 1 taken 613008 times.
|
637440 | if(temp_misc.shop[i].hasitem[k]==0) |
| 5616 | { | ||
| 5617 | 613008 | swaptmp = temp_misc.shop[i].item[k]; | |
| 5618 | 613008 | temp_misc.shop[i].item[k] = temp_misc.shop[i].item[k+1]; | |
| 5619 | 613008 | temp_misc.shop[i].item[k+1] = swaptmp; | |
| 5620 | 613008 | swaptmp = temp_misc.shop[i].price[k]; | |
| 5621 | 613008 | temp_misc.shop[i].price[k] = temp_misc.shop[i].price[k+1]; | |
| 5622 | 613008 | temp_misc.shop[i].price[k+1] = swaptmp; | |
| 5623 | 613008 | swaptmp = temp_misc.shop[i].hasitem[k]; | |
| 5624 | 613008 | temp_misc.shop[i].hasitem[k] = temp_misc.shop[i].hasitem[k+1]; | |
| 5625 | 613008 | temp_misc.shop[i].hasitem[k+1] = swaptmp; | |
| 5626 | 613008 | } | |
| 5627 | 637440 | } | |
| 5628 | 424960 | } | |
| 5629 | 212480 | } | |
| 5630 | |||
| 5631 | //infos | ||
| 5632 |
2/2✓ Branch 0 taken 806 times.
✓ Branch 1 taken 24 times.
|
830 | if(Header->zelda_version > 0x192) |
| 5633 | { | ||
| 5634 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_igetw(&infos,f)) |
| 5635 | { | ||
| 5636 | ✗ | return qe_invalid; | |
| 5637 | } | ||
| 5638 | 806 | } | |
| 5639 | |||
| 5640 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 830 times.
|
830 | if (infos > NUM_INFOS) |
| 5641 | { | ||
| 5642 | ✗ | return qe_invalid; | |
| 5643 | } | ||
| 5644 | |||
| 5645 | |||
| 5646 |
2/2✓ Branch 0 taken 10677 times.
✓ Branch 1 taken 830 times.
|
11507 | for(int32_t i=0; i<infos; i++) |
| 5647 | { | ||
| 5648 |
2/2✓ Branch 0 taken 9919 times.
✓ Branch 1 taken 758 times.
|
10677 | if(s_version > 6) |
| 5649 | { | ||
| 5650 |
2/4✓ Branch 0 taken 9919 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 9919 times.
|
9919 | if(!p_getstr(temp_misc.info[i].name,sizeof(temp_misc.info[i].name)-1,f)) |
| 5651 | { | ||
| 5652 | ✗ | return qe_invalid; | |
| 5653 | } | ||
| 5654 | 9919 | } | |
| 5655 | |||
| 5656 |
2/2✓ Branch 0 taken 32031 times.
✓ Branch 1 taken 10677 times.
|
42708 | for(int32_t j=0; j<3; j++) |
| 5657 | { | ||
| 5658 |
2/2✓ Branch 0 taken 31167 times.
✓ Branch 1 taken 864 times.
|
32319 | if((Header->zelda_version < 0x192)|| |
| 5659 |
2/2✓ Branch 0 taken 288 times.
✓ Branch 1 taken 30879 times.
|
31167 | ((Header->zelda_version == 0x192)&&(Header->build<146))) |
| 5660 | { | ||
| 5661 |
3/4✓ Branch 0 taken 864 times.
✓ Branch 1 taken 288 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 864 times.
|
1152 | if(!p_getc(&tempbyte,f)) |
| 5662 | { | ||
| 5663 | ✗ | return qe_invalid; | |
| 5664 | } | ||
| 5665 | |||
| 5666 | 864 | temp_misc.info[i].str[j]=tempbyte; | |
| 5667 | 864 | } | |
| 5668 | else | ||
| 5669 | { | ||
| 5670 |
3/4✓ Branch 0 taken 31167 times.
✓ Branch 1 taken 288 times.
✓ Branch 2 taken 31167 times.
✗ Branch 3 not taken.
|
30879 | if(!p_igetw(&temp_misc.info[i].str[j],f)) |
| 5671 | { | ||
| 5672 | ✗ | return qe_invalid; | |
| 5673 | } | ||
| 5674 | } | ||
| 5675 | 32031 | } | |
| 5676 | |||
| 5677 |
2/2✓ Branch 0 taken 384 times.
✓ Branch 1 taken 10293 times.
|
10677 | if(Header->zelda_version < 0x193) |
| 5678 | { | ||
| 5679 |
2/4✓ Branch 0 taken 384 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 384 times.
✗ Branch 3 not taken.
|
384 | if(!p_getc(&tempbyte,f)) |
| 5680 | { | ||
| 5681 | ✗ | return qe_invalid; | |
| 5682 | } | ||
| 5683 | 384 | } | |
| 5684 | |||
| 5685 |
3/4✓ Branch 0 taken 96 times.
✓ Branch 1 taken 10581 times.
✓ Branch 2 taken 96 times.
✗ Branch 3 not taken.
|
10677 | if((Header->zelda_version == 0x192)&&(Header->build>145)) |
| 5686 | { | ||
| 5687 |
2/4✓ Branch 0 taken 96 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 96 times.
✗ Branch 3 not taken.
|
96 | if(!p_getc(&padding,f)) |
| 5688 | { | ||
| 5689 | ✗ | return qe_invalid; | |
| 5690 | } | ||
| 5691 | 96 | } | |
| 5692 | |||
| 5693 |
2/2✓ Branch 0 taken 32031 times.
✓ Branch 1 taken 10677 times.
|
42708 | for(int32_t j=0; j<3; j++) |
| 5694 | { | ||
| 5695 |
2/4✓ Branch 0 taken 32031 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 32031 times.
|
32031 | if(!p_igetw(&temp_misc.info[i].price[j],f)) |
| 5696 | { | ||
| 5697 | ✗ | return qe_invalid; | |
| 5698 | } | ||
| 5699 | 32031 | } | |
| 5700 | 10677 | } | |
| 5701 | |||
| 5702 | //filter all the 0 strings to the end (yeah, bubble sort; sue me) | ||
| 5703 |
2/2✓ Branch 0 taken 212480 times.
✓ Branch 1 taken 830 times.
|
213310 | for(int32_t i=0; i<maxinfos; ++i) |
| 5704 | { | ||
| 5705 |
2/2✓ Branch 0 taken 424960 times.
✓ Branch 1 taken 212480 times.
|
637440 | for(int32_t j=0; j<3-1; j++) |
| 5706 | { | ||
| 5707 |
2/2✓ Branch 0 taken 637440 times.
✓ Branch 1 taken 424960 times.
|
1062400 | for(int32_t k=0; k<2-j; k++) |
| 5708 | { | ||
| 5709 |
2/2✓ Branch 0 taken 625355 times.
✓ Branch 1 taken 12085 times.
|
637440 | if(temp_misc.info[i].str[k]==0) |
| 5710 | { | ||
| 5711 | 625355 | swaptmp = temp_misc.info[i].str[k]; | |
| 5712 | 625355 | temp_misc.info[i].str[k] = temp_misc.info[i].str[k+1]; | |
| 5713 | 625355 | temp_misc.info[i].str[k+1] = swaptmp; | |
| 5714 | 625355 | swaptmp = temp_misc.info[i].price[k]; | |
| 5715 | 625355 | temp_misc.info[i].price[k] = temp_misc.info[i].price[k+1]; | |
| 5716 | 625355 | temp_misc.info[i].price[k+1] = swaptmp; | |
| 5717 | 625355 | } | |
| 5718 | 637440 | } | |
| 5719 | 424960 | } | |
| 5720 | 212480 | } | |
| 5721 | |||
| 5722 | |||
| 5723 | //warp rings | ||
| 5724 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 748 times.
|
830 | if(s_version > 5) |
| 5725 | 748 | warprings++; | |
| 5726 | |||
| 5727 |
2/2✓ Branch 0 taken 806 times.
✓ Branch 1 taken 24 times.
|
830 | if(Header->zelda_version > 0x192) |
| 5728 | { | ||
| 5729 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_igetw(&warprings,f)) |
| 5730 | { | ||
| 5731 | ✗ | return qe_invalid; | |
| 5732 | } | ||
| 5733 | |||
| 5734 |
2/2✓ Branch 0 taken 347 times.
✓ Branch 1 taken 459 times.
|
806 | if (warprings > NUM_WARP_RINGS) |
| 5735 | { | ||
| 5736 | // return qe_invalid; | ||
| 5737 | // Note: we can't actually fail here because for some reason, some quest files have more than the max | ||
| 5738 | // number of possible warp rings. Some examples of this are: demosp253.qst, yuurand.qst | ||
| 5739 | // So instead below we disable `keepdata` when reading the bad warp ring data, so no memory is corrupted. | ||
| 5740 | 459 | } | |
| 5741 | 806 | } | |
| 5742 | |||
| 5743 |
2/2✓ Branch 0 taken 8711 times.
✓ Branch 1 taken 830 times.
|
9541 | for(int32_t i=0; i<warprings; i++) |
| 5744 | { | ||
| 5745 | // See above comment on the `warprings` range check. | ||
| 5746 | 8711 | bool keepdata = i < NUM_WARP_RINGS; | |
| 5747 | |||
| 5748 |
2/2✓ Branch 0 taken 77295 times.
✓ Branch 1 taken 8711 times.
|
86006 | for(int32_t j=0; j<8+((s_version > 5)?1:0); j++) |
| 5749 | { | ||
| 5750 |
2/2✓ Branch 0 taken 68463 times.
✓ Branch 1 taken 8832 times.
|
77295 | if(s_version <= 3) |
| 5751 | { | ||
| 5752 |
2/4✓ Branch 0 taken 8832 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8832 times.
✗ Branch 3 not taken.
|
8832 | if(!p_getc(&tempbyte,f)) |
| 5753 | { | ||
| 5754 | ✗ | return qe_invalid; | |
| 5755 | } | ||
| 5756 | |||
| 5757 |
2/2✓ Branch 0 taken 3136 times.
✓ Branch 1 taken 5696 times.
|
8832 | if (keepdata) |
| 5758 | 5696 | temp_misc.warp[i].dmap[j]=(word)tempbyte; | |
| 5759 | 8832 | } | |
| 5760 | else | ||
| 5761 | { | ||
| 5762 | word tempword; | ||
| 5763 |
2/4✓ Branch 0 taken 68463 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 68463 times.
|
68463 | if(!p_igetw(&tempword,f)) |
| 5764 | { | ||
| 5765 | ✗ | return qe_invalid; | |
| 5766 | } | ||
| 5767 | |||
| 5768 |
2/2✓ Branch 0 taken 8181 times.
✓ Branch 1 taken 60282 times.
|
68463 | if (keepdata) |
| 5769 | 60282 | temp_misc.warp[i].dmap[j] = tempword; | |
| 5770 | } | ||
| 5771 | 77295 | } | |
| 5772 | |||
| 5773 |
2/2✓ Branch 0 taken 8711 times.
✓ Branch 1 taken 77295 times.
|
86006 | for(int32_t j=0; j<8+((s_version > 5)?1:0); j++) |
| 5774 | { | ||
| 5775 |
2/4✓ Branch 0 taken 77295 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77295 times.
✗ Branch 3 not taken.
|
77295 | if(!p_getc(&tempbyte,f)) |
| 5776 | { | ||
| 5777 | ✗ | return qe_invalid; | |
| 5778 | } | ||
| 5779 |
2/2✓ Branch 0 taken 11317 times.
✓ Branch 1 taken 65978 times.
|
77295 | if (keepdata) |
| 5780 | 65978 | temp_misc.warp[i].scr[j] = tempbyte; | |
| 5781 | 77295 | } | |
| 5782 | |||
| 5783 |
2/4✓ Branch 0 taken 8711 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8711 times.
✗ Branch 3 not taken.
|
8711 | if(!p_getc(&tempbyte,f)) |
| 5784 | { | ||
| 5785 | ✗ | return qe_invalid; | |
| 5786 | } | ||
| 5787 |
2/2✓ Branch 0 taken 1301 times.
✓ Branch 1 taken 7410 times.
|
8711 | if (keepdata) |
| 5788 | 7410 | temp_misc.warp[i].size = tempbyte; | |
| 5789 | |||
| 5790 |
2/2✓ Branch 0 taken 192 times.
✓ Branch 1 taken 8519 times.
|
8711 | if(Header->zelda_version < 0x193) |
| 5791 | { | ||
| 5792 |
2/4✓ Branch 0 taken 192 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 192 times.
|
192 | if(!p_getc(&tempbyte,f)) |
| 5793 | { | ||
| 5794 | ✗ | return qe_invalid; | |
| 5795 | } | ||
| 5796 | 192 | } | |
| 5797 | 8711 | } | |
| 5798 | |||
| 5799 | //palette cycles | ||
| 5800 |
2/2✓ Branch 0 taken 806 times.
✓ Branch 1 taken 24 times.
|
830 | if(Header->zelda_version < 0x193) //in 1.93+, palette cycling is saved with the palettes |
| 5801 | { | ||
| 5802 |
2/2✓ Branch 0 taken 6144 times.
✓ Branch 1 taken 24 times.
|
6168 | for(int32_t i=0; i<256; i++) |
| 5803 | { | ||
| 5804 |
2/2✓ Branch 0 taken 18432 times.
✓ Branch 1 taken 6144 times.
|
24576 | for(int32_t j=0; j<3; j++) |
| 5805 | { | ||
| 5806 | 18432 | temp_misc.cycles[i][j].first=0; | |
| 5807 | 18432 | temp_misc.cycles[i][j].count=0; | |
| 5808 | 18432 | temp_misc.cycles[i][j].speed=0; | |
| 5809 | 18432 | } | |
| 5810 | 6144 | } | |
| 5811 | |||
| 5812 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
30 | if((Header->zelda_version < 0x192)|| |
| 5813 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((Header->zelda_version == 0x192)&&(Header->build<73))) |
| 5814 | { | ||
| 5815 | 18 | palcycles=16; | |
| 5816 | 18 | } | |
| 5817 | |||
| 5818 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 1824 times.
|
1848 | for(int32_t i=0; i<palcycles; i++) |
| 5819 | { | ||
| 5820 |
2/2✓ Branch 0 taken 1824 times.
✓ Branch 1 taken 5472 times.
|
7296 | for(int32_t j=0; j<3; j++) |
| 5821 | { | ||
| 5822 |
2/4✓ Branch 0 taken 5472 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5472 times.
✗ Branch 3 not taken.
|
5472 | if(!p_getc(&temp_misc.cycles[i][j].first,f)) |
| 5823 | { | ||
| 5824 | ✗ | return qe_invalid; | |
| 5825 | } | ||
| 5826 | |||
| 5827 |
2/4✓ Branch 0 taken 5472 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5472 times.
✗ Branch 3 not taken.
|
5472 | if(!p_getc(&temp_misc.cycles[i][j].count,f)) |
| 5828 | { | ||
| 5829 | ✗ | return qe_invalid; | |
| 5830 | } | ||
| 5831 | |||
| 5832 |
2/4✓ Branch 0 taken 5472 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5472 times.
|
5472 | if(!p_getc(&temp_misc.cycles[i][j].speed,f)) |
| 5833 | { | ||
| 5834 | ✗ | return qe_invalid; | |
| 5835 | } | ||
| 5836 | 5472 | } | |
| 5837 | 1824 | } | |
| 5838 | 24 | } | |
| 5839 | |||
| 5840 | //Wind warps are now just another warp ring. | ||
| 5841 |
2/2✓ Branch 0 taken 748 times.
✓ Branch 1 taken 82 times.
|
830 | if(s_version <= 5) |
| 5842 | { | ||
| 5843 |
2/2✓ Branch 0 taken 58 times.
✓ Branch 1 taken 24 times.
|
82 | if(Header->zelda_version > 0x192) |
| 5844 | { | ||
| 5845 |
2/4✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 58 times.
✗ Branch 3 not taken.
|
58 | if(!p_igetw(&windwarps,f)) |
| 5846 | { | ||
| 5847 | ✗ | return qe_invalid; | |
| 5848 | } | ||
| 5849 | 58 | } | |
| 5850 | |||
| 5851 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if (windwarps > NUM_WARP_RINGS) |
| 5852 | { | ||
| 5853 | ✗ | return qe_invalid; | |
| 5854 | } | ||
| 5855 | |||
| 5856 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 657 times.
|
739 | for(int32_t i=0; i<windwarps; i++) |
| 5857 | { | ||
| 5858 |
1/2✓ Branch 0 taken 657 times.
✗ Branch 1 not taken.
|
657 | if(s_version <= 3) |
| 5859 | { | ||
| 5860 |
2/4✓ Branch 0 taken 657 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 657 times.
✗ Branch 3 not taken.
|
657 | if(!p_getc(&tempbyte,f)) |
| 5861 | { | ||
| 5862 | ✗ | return qe_invalid; | |
| 5863 | } | ||
| 5864 | |||
| 5865 | 657 | temp_misc.warp[8].dmap[i]=tempbyte; | |
| 5866 | 657 | } | |
| 5867 | else | ||
| 5868 | { | ||
| 5869 | ✗ | if(!p_igetw(&temp_misc.warp[8].dmap[i],f)) | |
| 5870 | { | ||
| 5871 | ✗ | return qe_invalid; | |
| 5872 | } | ||
| 5873 | } | ||
| 5874 | |||
| 5875 |
2/4✓ Branch 0 taken 657 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 657 times.
✗ Branch 3 not taken.
|
657 | if(!p_getc(&temp_misc.warp[8].scr[i],f)) |
| 5876 | { | ||
| 5877 | ✗ | return qe_invalid; | |
| 5878 | } | ||
| 5879 | |||
| 5880 | 657 | temp_misc.warp[8].size = 9; | |
| 5881 | |||
| 5882 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 657 times.
|
657 | if(s_version == 5) |
| 5883 | { | ||
| 5884 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 5885 | { | ||
| 5886 | ✗ | return qe_invalid; | |
| 5887 | } | ||
| 5888 | ✗ | } | |
| 5889 | 657 | } | |
| 5890 | 82 | } | |
| 5891 | |||
| 5892 | |||
| 5893 | //triforce pieces | ||
| 5894 |
2/2✓ Branch 0 taken 830 times.
✓ Branch 1 taken 6640 times.
|
7470 | for(int32_t i=0; i<triforces; i++) |
| 5895 | { | ||
| 5896 |
2/4✓ Branch 0 taken 6640 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6640 times.
|
6640 | if(!p_getc(&temp_misc.triforce[i],f)) |
| 5897 | { | ||
| 5898 | ✗ | return qe_invalid; | |
| 5899 | } | ||
| 5900 | 6640 | } | |
| 5901 | |||
| 5902 | //misc color data | ||
| 5903 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 748 times.
|
830 | if(s_version<3) |
| 5904 | { | ||
| 5905 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.text,f)) |
| 5906 | { | ||
| 5907 | ✗ | return qe_invalid; | |
| 5908 | } | ||
| 5909 | |||
| 5910 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.caption,f)) |
| 5911 | { | ||
| 5912 | ✗ | return qe_invalid; | |
| 5913 | } | ||
| 5914 | |||
| 5915 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.overw_bg,f)) |
| 5916 | { | ||
| 5917 | ✗ | return qe_invalid; | |
| 5918 | } | ||
| 5919 | |||
| 5920 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.dngn_bg,f)) |
| 5921 | { | ||
| 5922 | ✗ | return qe_invalid; | |
| 5923 | } | ||
| 5924 | |||
| 5925 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.dngn_fg,f)) |
| 5926 | { | ||
| 5927 | ✗ | return qe_invalid; | |
| 5928 | } | ||
| 5929 | |||
| 5930 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.cave_fg,f)) |
| 5931 | { | ||
| 5932 | ✗ | return qe_invalid; | |
| 5933 | } | ||
| 5934 | |||
| 5935 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.bs_dk,f)) |
| 5936 | { | ||
| 5937 | ✗ | return qe_invalid; | |
| 5938 | } | ||
| 5939 | |||
| 5940 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.bs_goal,f)) |
| 5941 | { | ||
| 5942 | ✗ | return qe_invalid; | |
| 5943 | } | ||
| 5944 | |||
| 5945 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.compass_lt,f)) |
| 5946 | { | ||
| 5947 | ✗ | return qe_invalid; | |
| 5948 | } | ||
| 5949 | |||
| 5950 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.compass_dk,f)) |
| 5951 | { | ||
| 5952 | ✗ | return qe_invalid; | |
| 5953 | } | ||
| 5954 | |||
| 5955 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.subscr_bg,f)) |
| 5956 | { | ||
| 5957 | ✗ | return qe_invalid; | |
| 5958 | } | ||
| 5959 | |||
| 5960 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.triframe_color,f)) |
| 5961 | { | ||
| 5962 | ✗ | return qe_invalid; | |
| 5963 | } | ||
| 5964 | |||
| 5965 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.hero_dot,f)) |
| 5966 | { | ||
| 5967 | ✗ | return qe_invalid; | |
| 5968 | } | ||
| 5969 | |||
| 5970 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.bmap_bg,f)) |
| 5971 | { | ||
| 5972 | ✗ | return qe_invalid; | |
| 5973 | } | ||
| 5974 | |||
| 5975 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.bmap_fg,f)) |
| 5976 | { | ||
| 5977 | ✗ | return qe_invalid; | |
| 5978 | } | ||
| 5979 | |||
| 5980 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.triforce_cset,f)) |
| 5981 | { | ||
| 5982 | ✗ | return qe_invalid; | |
| 5983 | } | ||
| 5984 | |||
| 5985 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.triframe_cset,f)) |
| 5986 | { | ||
| 5987 | ✗ | return qe_invalid; | |
| 5988 | } | ||
| 5989 | |||
| 5990 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.overworld_map_cset,f)) |
| 5991 | { | ||
| 5992 | ✗ | return qe_invalid; | |
| 5993 | } | ||
| 5994 | |||
| 5995 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.dungeon_map_cset,f)) |
| 5996 | { | ||
| 5997 | ✗ | return qe_invalid; | |
| 5998 | } | ||
| 5999 | |||
| 6000 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.blueframe_cset,f)) |
| 6001 | { | ||
| 6002 | ✗ | return qe_invalid; | |
| 6003 | } | ||
| 6004 | |||
| 6005 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_igetw(&temp_misc.colors.triforce_tile,f)) |
| 6006 | { | ||
| 6007 | ✗ | return qe_invalid; | |
| 6008 | } | ||
| 6009 | |||
| 6010 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_igetw(&temp_misc.colors.triframe_tile,f)) |
| 6011 | { | ||
| 6012 | ✗ | return qe_invalid; | |
| 6013 | } | ||
| 6014 | |||
| 6015 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_igetw(&temp_misc.colors.overworld_map_tile,f)) |
| 6016 | { | ||
| 6017 | ✗ | return qe_invalid; | |
| 6018 | } | ||
| 6019 | |||
| 6020 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_igetw(&temp_misc.colors.dungeon_map_tile,f)) |
| 6021 | { | ||
| 6022 | ✗ | return qe_invalid; | |
| 6023 | } | ||
| 6024 | |||
| 6025 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_igetw(&temp_misc.colors.blueframe_tile,f)) |
| 6026 | { | ||
| 6027 | ✗ | return qe_invalid; | |
| 6028 | } | ||
| 6029 | |||
| 6030 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_igetw(&temp_misc.colors.HCpieces_tile,f)) |
| 6031 | { | ||
| 6032 | ✗ | return qe_invalid; | |
| 6033 | } | ||
| 6034 | |||
| 6035 |
2/4✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
82 | if(!p_getc(&temp_misc.colors.HCpieces_cset,f)) |
| 6036 | { | ||
| 6037 | ✗ | return qe_invalid; | |
| 6038 | } | ||
| 6039 | |||
| 6040 | 82 | temp_misc.colors.msgtext = 0x01; | |
| 6041 | |||
| 6042 |
2/2✓ Branch 0 taken 58 times.
✓ Branch 1 taken 24 times.
|
82 | if(Header->zelda_version < 0x193) |
| 6043 | { | ||
| 6044 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 24 times.
|
192 | for(int32_t i=0; i<7; i++) |
| 6045 | { | ||
| 6046 |
2/4✓ Branch 0 taken 168 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 168 times.
✗ Branch 3 not taken.
|
168 | if(!p_getc(&tempbyte,f)) |
| 6047 | { | ||
| 6048 | ✗ | return qe_invalid; | |
| 6049 | } | ||
| 6050 | 168 | } | |
| 6051 | 24 | } | |
| 6052 | |||
| 6053 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 76 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
82 | if((Header->zelda_version == 0x192)&&(Header->build>145)) |
| 6054 | { | ||
| 6055 |
2/2✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 6 times.
|
1542 | for(int32_t i=0; i<256; i++) |
| 6056 | { | ||
| 6057 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&tempbyte,f)) |
| 6058 | { | ||
| 6059 | ✗ | return qe_invalid; | |
| 6060 | } | ||
| 6061 | 1536 | } | |
| 6062 | 6 | } | |
| 6063 | |||
| 6064 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if(s_version>1) |
| 6065 | { | ||
| 6066 | ✗ | if(!p_getc(&temp_misc.colors.subscr_shadow,f)) | |
| 6067 | { | ||
| 6068 | ✗ | return qe_invalid; | |
| 6069 | } | ||
| 6070 | ✗ | } | |
| 6071 | |||
| 6072 | //save game icons | ||
| 6073 |
3/4✓ Branch 0 taken 64 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
88 | if((Header->zelda_version < 0x192)|| |
| 6074 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 58 times.
|
64 | ((Header->zelda_version == 0x192)&&(Header->build<73))) |
| 6075 | { | ||
| 6076 | 18 | icons=3; | |
| 6077 | 18 | } | |
| 6078 | |||
| 6079 |
2/2✓ Branch 0 taken 310 times.
✓ Branch 1 taken 82 times.
|
392 | for(int32_t i=0; i<icons; i++) |
| 6080 | { | ||
| 6081 |
2/4✓ Branch 0 taken 310 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 310 times.
✗ Branch 3 not taken.
|
310 | if(!p_igetw(&temp_misc.icons[i],f)) |
| 6082 | { | ||
| 6083 | ✗ | return qe_invalid; | |
| 6084 | } | ||
| 6085 | 310 | } | |
| 6086 | 82 | } | |
| 6087 | |||
| 6088 |
3/4✓ Branch 0 taken 812 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
836 | if((Header->zelda_version < 0x192)|| |
| 6089 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 806 times.
|
812 | ((Header->zelda_version == 0x192)&&(Header->build<30))) |
| 6090 | { | ||
| 6091 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | *Misc = temp_misc; |
| 6092 | |||
| 6093 | 18 | return 0; | |
| 6094 | } | ||
| 6095 | |||
| 6096 | //pond information | ||
| 6097 |
2/2✓ Branch 0 taken 806 times.
✓ Branch 1 taken 6 times.
|
812 | if(Header->zelda_version < 0x193) |
| 6098 | { | ||
| 6099 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | if((Header->zelda_version == 0x192)&&(Header->build<146)) |
| 6100 | { | ||
| 6101 | ✗ | pondsize=25; | |
| 6102 | ✗ | } | |
| 6103 | |||
| 6104 |
2/2✓ Branch 0 taken 96 times.
✓ Branch 1 taken 6 times.
|
102 | for(int32_t i=0; i<ponds; i++) |
| 6105 | { | ||
| 6106 |
2/2✓ Branch 0 taken 6912 times.
✓ Branch 1 taken 96 times.
|
7008 | for(int32_t j=0; j<pondsize; j++) |
| 6107 | { | ||
| 6108 |
2/4✓ Branch 0 taken 6912 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6912 times.
✗ Branch 3 not taken.
|
6912 | if(!p_getc(&tempbyte,f)) |
| 6109 | { | ||
| 6110 | ✗ | return qe_invalid; | |
| 6111 | |||
| 6112 | } | ||
| 6113 | 6912 | } | |
| 6114 | 96 | } | |
| 6115 | 6 | } | |
| 6116 | |||
| 6117 | //end string | ||
| 6118 | 818 | if((Header->zelda_version < 0x192)|| | |
| 6119 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 806 times.
|
812 | ((Header->zelda_version == 0x192)&&(Header->build<146))) |
| 6120 | { | ||
| 6121 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6 | if(!p_getc(&tempbyte,f)) |
| 6122 | { | ||
| 6123 | ✗ | return qe_invalid; | |
| 6124 | } | ||
| 6125 | |||
| 6126 | ✗ | temp_misc.endstring=tempbyte; | |
| 6127 | |||
| 6128 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 6129 | { | ||
| 6130 | ✗ | return qe_invalid; | |
| 6131 | } | ||
| 6132 | ✗ | } | |
| 6133 | else | ||
| 6134 | { | ||
| 6135 |
3/4✓ Branch 0 taken 812 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 812 times.
✗ Branch 3 not taken.
|
806 | if(!p_igetw(&temp_misc.endstring,f)) |
| 6136 | { | ||
| 6137 | ✗ | return qe_invalid; | |
| 6138 | } | ||
| 6139 | } | ||
| 6140 | |||
| 6141 | //expansion | ||
| 6142 |
2/2✓ Branch 0 taken 806 times.
✓ Branch 1 taken 6 times.
|
812 | if(Header->zelda_version < 0x193) |
| 6143 | { | ||
| 6144 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | if((Header->zelda_version == 0x192)&&(Header->build<73)) |
| 6145 | { | ||
| 6146 | ✗ | expansionsize=99*2; | |
| 6147 | ✗ | } | |
| 6148 | |||
| 6149 |
2/2✓ Branch 0 taken 1176 times.
✓ Branch 1 taken 6 times.
|
1182 | for(int32_t i=0; i<expansionsize; i++) |
| 6150 | { | ||
| 6151 |
2/4✓ Branch 0 taken 1176 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1176 times.
✗ Branch 3 not taken.
|
1176 | if(!p_getc(&tempbyte,f)) |
| 6152 | { | ||
| 6153 | ✗ | return qe_invalid; | |
| 6154 | } | ||
| 6155 | 1176 | } | |
| 6156 | 6 | } | |
| 6157 | //shops v8 | ||
| 6158 | |||
| 6159 | |||
| 6160 |
2/2✓ Branch 0 taken 597 times.
✓ Branch 1 taken 215 times.
|
812 | if(s_version >= 8) |
| 6161 | { | ||
| 6162 |
2/2✓ Branch 0 taken 2528 times.
✓ Branch 1 taken 215 times.
|
2743 | for(int32_t i=0; i<shops; i++) |
| 6163 | { | ||
| 6164 |
2/2✓ Branch 0 taken 7584 times.
✓ Branch 1 taken 2528 times.
|
10112 | for(int32_t j=0; j<3; j++) |
| 6165 | { | ||
| 6166 |
2/4✓ Branch 0 taken 7584 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7584 times.
✗ Branch 3 not taken.
|
7584 | if(!p_igetw(&temp_misc.shop[i].str[j],f)) |
| 6167 | ✗ | return qe_invalid; | |
| 6168 | 7584 | } | |
| 6169 | 2528 | } | |
| 6170 | 215 | } | |
| 6171 | |||
| 6172 | 812 | memset(&temp_misc.questmisc, 0, sizeof(int32_t)*32); | |
| 6173 | 812 | memset(&temp_misc.zscript_last_compiled_version, 0, sizeof(int32_t)); | |
| 6174 | |||
| 6175 | //v9 includes quest misc[32] | ||
| 6176 | // ... this has been deprecated (2024) | ||
| 6177 |
2/2✓ Branch 0 taken 597 times.
✓ Branch 1 taken 215 times.
|
812 | if(s_version >= 9) |
| 6178 | { | ||
| 6179 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 6880 times.
|
7095 | for ( int32_t q = 0; q < 32; q++ ) |
| 6180 | { | ||
| 6181 |
2/4✓ Branch 0 taken 6880 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6880 times.
✗ Branch 3 not taken.
|
6880 | if(!p_igetl(&temp_misc.questmisc[q],f)) |
| 6182 | ✗ | return qe_invalid; | |
| 6183 | 6880 | } | |
| 6184 | // this was string labels | ||
| 6185 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 215 times.
|
215 | if (pack_fseek(f, 32 * 128)) |
| 6186 | ✗ | return qe_invalid; | |
| 6187 | 215 | } | |
| 6188 | |||
| 6189 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 597 times.
|
812 | if(s_version >= 11 ) |
| 6190 | { | ||
| 6191 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | if(!p_igetl(&temp_misc.zscript_last_compiled_version,f)) |
| 6192 | ✗ | return qe_invalid; | |
| 6193 | 215 | } | |
| 6194 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 597 times.
|
597 | else if(s_version < 11 ) |
| 6195 | { | ||
| 6196 | 597 | temp_misc.zscript_last_compiled_version = -1; | |
| 6197 | 597 | } | |
| 6198 | |||
| 6199 | 812 | FFCore.quest_format[vLastCompile] = temp_misc.zscript_last_compiled_version; | |
| 6200 | |||
| 6201 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 597 times.
|
812 | if(s_version >= 12) |
| 6202 | { | ||
| 6203 | byte spr; | ||
| 6204 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 215 times.
|
55255 | for(int32_t q = 0; q < sprMAX; ++q) |
| 6205 | { | ||
| 6206 |
2/4✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 55040 times.
✗ Branch 3 not taken.
|
55040 | if(!p_getc(&spr,f)) |
| 6207 | ✗ | return qe_invalid; | |
| 6208 | 55040 | temp_misc.sprites[q] = spr; | |
| 6209 | 55040 | } | |
| 6210 | 215 | } | |
| 6211 | else | ||
| 6212 | { | ||
| 6213 | 597 | memset(&(temp_misc.sprites), 0, sizeof(temp_misc.sprites)); | |
| 6214 | //temp_misc.sprites[sprFALL] = ; | ||
| 6215 | } | ||
| 6216 | |||
| 6217 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 597 times.
|
812 | if(s_version >= 13) |
| 6218 | { | ||
| 6219 |
2/2✓ Branch 0 taken 13760 times.
✓ Branch 1 taken 215 times.
|
13975 | for(size_t q = 0; q < 64; ++q) |
| 6220 | { | ||
| 6221 | 13760 | bottletype* bt = &(temp_misc.bottle_types[q]); | |
| 6222 |
2/4✓ Branch 0 taken 13760 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13760 times.
✗ Branch 3 not taken.
|
13760 | if (!p_getstr(bt->name, sizeof(bt->name)-1, f)) |
| 6223 | ✗ | return qe_invalid; | |
| 6224 |
2/2✓ Branch 0 taken 13760 times.
✓ Branch 1 taken 41280 times.
|
55040 | for(size_t j = 0; j < 3; ++j) |
| 6225 | { | ||
| 6226 |
2/4✓ Branch 0 taken 41280 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 41280 times.
✗ Branch 3 not taken.
|
41280 | if (!p_getc(&(bt->counter[j]), f)) |
| 6227 | ✗ | return qe_invalid; | |
| 6228 |
2/4✓ Branch 0 taken 41280 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 41280 times.
✗ Branch 3 not taken.
|
41280 | if (!p_igetw(&(bt->amount[j]), f)) |
| 6229 | ✗ | return qe_invalid; | |
| 6230 | 41280 | } | |
| 6231 |
2/4✓ Branch 0 taken 13760 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13760 times.
✗ Branch 3 not taken.
|
13760 | if (!p_getc(&(bt->flags), f)) |
| 6232 | ✗ | return qe_invalid; | |
| 6233 |
2/4✓ Branch 0 taken 13760 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13760 times.
✗ Branch 3 not taken.
|
13760 | if (!p_getc(&(bt->next_type), f)) |
| 6234 | ✗ | return qe_invalid; | |
| 6235 | 13760 | } | |
| 6236 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 215 times.
|
55255 | for(size_t q = 0; q < 256; ++q) |
| 6237 | { | ||
| 6238 | 55040 | bottleshoptype* bst = &(temp_misc.bottle_shop_types[q]); | |
| 6239 |
2/4✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 55040 times.
✗ Branch 3 not taken.
|
55040 | if (!pfread(bst->name, sizeof(bst->name)-1, f)) |
| 6240 | ✗ | return qe_invalid; | |
| 6241 |
2/2✓ Branch 0 taken 165120 times.
✓ Branch 1 taken 55040 times.
|
220160 | for(size_t j = 0; j < 3; ++j) |
| 6242 | { | ||
| 6243 |
2/4✓ Branch 0 taken 165120 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 165120 times.
✗ Branch 3 not taken.
|
165120 | if (!p_getc(&(bst->fill[j]), f)) |
| 6244 | ✗ | return qe_invalid; | |
| 6245 |
2/4✓ Branch 0 taken 165120 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 165120 times.
✗ Branch 3 not taken.
|
165120 | if (!p_igetw(&(bst->comb[j]), f)) |
| 6246 | ✗ | return qe_invalid; | |
| 6247 |
2/4✓ Branch 0 taken 165120 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 165120 times.
✗ Branch 3 not taken.
|
165120 | if (!p_getc(&(bst->cset[j]), f)) |
| 6248 | ✗ | return qe_invalid; | |
| 6249 |
2/4✓ Branch 0 taken 165120 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 165120 times.
✗ Branch 3 not taken.
|
165120 | if (!p_igetw(&(bst->price[j]), f)) |
| 6250 | ✗ | return qe_invalid; | |
| 6251 |
2/4✓ Branch 0 taken 165120 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 165120 times.
✗ Branch 3 not taken.
|
165120 | if (!p_igetw(&(bst->str[j]), f)) |
| 6252 | ✗ | return qe_invalid; | |
| 6253 | 165120 | } | |
| 6254 | 55040 | } | |
| 6255 | 215 | } | |
| 6256 | else | ||
| 6257 | { | ||
| 6258 |
2/2✓ Branch 0 taken 38208 times.
✓ Branch 1 taken 597 times.
|
38805 | for(size_t q = 0; q < 64; ++q) |
| 6259 |
1/2✓ Branch 0 taken 38208 times.
✗ Branch 1 not taken.
|
38208 | temp_misc.bottle_types[q].clear(); |
| 6260 |
2/2✓ Branch 0 taken 152832 times.
✓ Branch 1 taken 597 times.
|
153429 | for(size_t q = 0; q < 256; ++q) |
| 6261 |
1/2✓ Branch 0 taken 152832 times.
✗ Branch 1 not taken.
|
152832 | temp_misc.bottle_shop_types[q].clear(); |
| 6262 | } | ||
| 6263 | |||
| 6264 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 597 times.
|
812 | if(s_version >= 14) |
| 6265 | { | ||
| 6266 | byte msfx; | ||
| 6267 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 215 times.
|
55255 | for(int32_t q = 0; q < sfxMAX; ++q) |
| 6268 | { | ||
| 6269 |
2/4✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 55040 times.
✗ Branch 3 not taken.
|
55040 | if(!p_getc(&msfx,f)) |
| 6270 | ✗ | return qe_invalid; | |
| 6271 | 55040 | temp_misc.miscsfx[q] = msfx; | |
| 6272 | 55040 | } | |
| 6273 | 215 | } | |
| 6274 | else | ||
| 6275 | { | ||
| 6276 | 597 | memset(&(temp_misc.miscsfx), 0, sizeof(temp_misc.miscsfx)); | |
| 6277 | 597 | temp_misc.miscsfx[sfxBUSHGRASS] = WAV_ZN1GRASSCUT; | |
| 6278 | 597 | temp_misc.miscsfx[sfxLOWHEART] = WAV_ER; | |
| 6279 | } | ||
| 6280 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 597 times.
|
812 | if(s_version < 15) |
| 6281 | { | ||
| 6282 | 597 | temp_misc.miscsfx[sfxHURTPLAYER] = WAV_OUCH; | |
| 6283 | 597 | temp_misc.miscsfx[sfxHAMMERPOUND] = WAV_ZN1HAMMERPOST; | |
| 6284 | 597 | temp_misc.miscsfx[sfxSUBSCR_ITEM_ASSIGN] = WAV_PLACE; | |
| 6285 | 597 | temp_misc.miscsfx[sfxSUBSCR_CURSOR_MOVE] = WAV_CHIME; | |
| 6286 | 597 | temp_misc.miscsfx[sfxREFILL] = WAV_MSG; | |
| 6287 | 597 | temp_misc.miscsfx[sfxDRAIN] = WAV_MSG; | |
| 6288 | 597 | } | |
| 6289 |
2/2✓ Branch 0 taken 198 times.
✓ Branch 1 taken 614 times.
|
812 | if(s_version < 16) |
| 6290 | { | ||
| 6291 | 614 | temp_misc.miscsfx[sfxTAP] = WAV_ZN1TAP; | |
| 6292 | 614 | temp_misc.miscsfx[sfxTAP_HOLLOW] = WAV_ZN1TAP2; | |
| 6293 | 614 | } | |
| 6294 |
2/2✓ Branch 0 taken 133 times.
✓ Branch 1 taken 679 times.
|
812 | if (s_version >= 17) |
| 6295 | { | ||
| 6296 | 133 | byte save_menu_count = 0; | |
| 6297 |
2/4✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✗ Branch 3 not taken.
|
133 | if (!p_getc(&save_menu_count, f)) |
| 6298 | ✗ | return qe_invalid; | |
| 6299 |
1/2✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
|
133 | for(size_t q = 0; q < save_menu_count; ++q) |
| 6300 | { | ||
| 6301 | ✗ | SaveMenu& menu = temp_misc.save_menus[q]; | |
| 6302 | ✗ | menu.clear(); | |
| 6303 | |||
| 6304 | byte menu_empty; | ||
| 6305 | ✗ | if (!p_getc(&menu_empty, f)) | |
| 6306 | ✗ | return qe_invalid; | |
| 6307 | ✗ | if (menu_empty) | |
| 6308 | ✗ | continue; | |
| 6309 | |||
| 6310 | ✗ | if (!p_getcstr(&menu.name, f)) | |
| 6311 | ✗ | return qe_invalid; | |
| 6312 | |||
| 6313 | ✗ | if (!p_igetw(&menu.flags, f)) | |
| 6314 | ✗ | return qe_invalid; | |
| 6315 | |||
| 6316 | ✗ | if (!p_igetl(&menu.cursor_tile, f)) | |
| 6317 | ✗ | return qe_invalid; | |
| 6318 | |||
| 6319 | ✗ | if (!p_getc(&menu.cursor_cset, f)) | |
| 6320 | ✗ | return qe_invalid; | |
| 6321 | |||
| 6322 | ✗ | if (!p_getc(&menu.cursor_sfx, f)) | |
| 6323 | ✗ | return qe_invalid; | |
| 6324 | |||
| 6325 | ✗ | if (!p_getc(&menu.choose_sfx, f)) | |
| 6326 | ✗ | return qe_invalid; | |
| 6327 | |||
| 6328 | ✗ | if (!p_getc(&menu.bg_color, f)) | |
| 6329 | ✗ | return qe_invalid; | |
| 6330 | |||
| 6331 | ✗ | if (!p_getc(&menu.hspace, f)) | |
| 6332 | ✗ | return qe_invalid; | |
| 6333 | |||
| 6334 | ✗ | if (!p_getc(&menu.vspace, f)) | |
| 6335 | ✗ | return qe_invalid; | |
| 6336 | |||
| 6337 | ✗ | if (!p_getc(&menu.opt_x, f)) | |
| 6338 | ✗ | return qe_invalid; | |
| 6339 | |||
| 6340 | ✗ | if (!p_getc(&menu.opt_y, f)) | |
| 6341 | ✗ | return qe_invalid; | |
| 6342 | |||
| 6343 | ✗ | if (!p_getc(&menu.text_align, f)) | |
| 6344 | ✗ | return qe_invalid; | |
| 6345 | |||
| 6346 | ✗ | if (!p_getc(&menu.textbox_align, f)) | |
| 6347 | ✗ | return qe_invalid; | |
| 6348 | |||
| 6349 | ✗ | if (!p_igetw(&menu.close_frames, f)) | |
| 6350 | ✗ | return qe_invalid; | |
| 6351 | |||
| 6352 | ✗ | if (!p_getc(&menu.close_flash_rate, f)) | |
| 6353 | ✗ | return qe_invalid; | |
| 6354 | |||
| 6355 | ✗ | if (s_version < 18) | |
| 6356 | { | ||
| 6357 | int16_t midi; | ||
| 6358 | ✗ | if (!p_igetw(&midi, f)) | |
| 6359 | ✗ | return qe_invalid; | |
| 6360 | ✗ | if (should_skip) | |
| 6361 | ✗ | menu.music = 0; | |
| 6362 | ✗ | else menu.music = find_or_make_midi_music(convert_from_old_midi_id(midi)); | |
| 6363 | ✗ | } | |
| 6364 | ✗ | else if (!p_igetw(&menu.music, f)) | |
| 6365 | ✗ | return qe_invalid; | |
| 6366 | |||
| 6367 | ✗ | if (!p_igetl(&menu.bg_tile, f)) | |
| 6368 | ✗ | return qe_invalid; | |
| 6369 | |||
| 6370 | ✗ | if (!p_getc(&menu.bg_cset, f)) | |
| 6371 | ✗ | return qe_invalid; | |
| 6372 | |||
| 6373 | ✗ | if (!p_getc(&menu.bg_tw, f)) | |
| 6374 | ✗ | return qe_invalid; | |
| 6375 | |||
| 6376 | ✗ | if (!p_getc(&menu.bg_th, f)) | |
| 6377 | ✗ | return qe_invalid; | |
| 6378 | |||
| 6379 | byte opt_count; | ||
| 6380 | ✗ | if (!p_getc(&opt_count, f)) | |
| 6381 | ✗ | return qe_invalid; | |
| 6382 | ✗ | menu.options.resize(opt_count); | |
| 6383 | |||
| 6384 | ✗ | for (size_t q = 0; q < opt_count; ++q) | |
| 6385 | { | ||
| 6386 | ✗ | SaveMenuOption& opt = menu.options[q]; | |
| 6387 | |||
| 6388 | ✗ | if (!p_getcstr(&opt.text, f)) | |
| 6389 | ✗ | return qe_invalid; | |
| 6390 | |||
| 6391 | ✗ | if (!p_igetw(&opt.flags, f)) | |
| 6392 | ✗ | return qe_invalid; | |
| 6393 | |||
| 6394 | ✗ | if (!p_getc(&opt.color, f)) | |
| 6395 | ✗ | return qe_invalid; | |
| 6396 | |||
| 6397 | ✗ | if (!p_getc(&opt.picked_color, f)) | |
| 6398 | ✗ | return qe_invalid; | |
| 6399 | |||
| 6400 | ✗ | if (!p_igetl(&opt.font, f)) | |
| 6401 | ✗ | return qe_invalid; | |
| 6402 | |||
| 6403 | ✗ | if (!p_igetw(&opt.gen_script, f)) | |
| 6404 | ✗ | return qe_invalid; | |
| 6405 | ✗ | } | |
| 6406 | ✗ | } | |
| 6407 | |||
| 6408 |
2/4✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✗ Branch 3 not taken.
|
133 | if (!p_getc(&temp_misc.savemenu_game_over, f)) |
| 6409 | ✗ | return qe_invalid; | |
| 6410 |
2/4✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✗ Branch 3 not taken.
|
133 | if (!p_getc(&temp_misc.savemenu_f6, f)) |
| 6411 | ✗ | return qe_invalid; | |
| 6412 | 133 | } | |
| 6413 | |||
| 6414 |
2/2✓ Branch 0 taken 811 times.
✓ Branch 1 taken 1 times.
|
812 | if (!should_skip) |
| 6415 |
1/2✓ Branch 0 taken 811 times.
✗ Branch 1 not taken.
|
811 | *Misc = temp_misc; |
| 6416 | |||
| 6417 | 812 | return 0; | |
| 6418 | 2006 | } | |
| 6419 | |||
| 6420 | extern char *item_string[MAXITEMS]; | ||
| 6421 | extern const char *old_item_string[iLast]; | ||
| 6422 | extern char *weapon_string[MAXWPNS]; | ||
| 6423 | extern const char *old_weapon_string[wLast]; | ||
| 6424 | |||
| 6425 | 497 | int32_t readitems(PACKFILE *f, word version, word build) | |
| 6426 | { | ||
| 6427 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 24 times.
|
497 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_items); |
| 6428 | |||
| 6429 | byte padding; | ||
| 6430 | int32_t dummy; | ||
| 6431 | 497 | word items_to_read=MAXITEMS; | |
| 6432 | 497 | itemdata tempitem; | |
| 6433 | 497 | word s_version=0; | |
| 6434 | word dummy_word; | ||
| 6435 | |||
| 6436 |
2/2✓ Branch 0 taken 491 times.
✓ Branch 1 taken 6 times.
|
497 | if(version < 0x186) |
| 6437 | { | ||
| 6438 | 6 | items_to_read=64; | |
| 6439 | 6 | } | |
| 6440 | |||
| 6441 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 473 times.
|
497 | if(version > 0x192) |
| 6442 | { | ||
| 6443 | 473 | items_to_read=0; | |
| 6444 | |||
| 6445 | //section version info | ||
| 6446 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetw(&s_version,f)) |
| 6447 | { | ||
| 6448 | ✗ | return qe_invalid; | |
| 6449 | } | ||
| 6450 | |||
| 6451 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if (s_version > V_ITEMS) |
| 6452 | ✗ | return qe_version; | |
| 6453 | |||
| 6454 | 473 | FFCore.quest_format[vItems] = s_version; | |
| 6455 | |||
| 6456 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!read_deprecated_section_cversion(f)) |
| 6457 | { | ||
| 6458 | ✗ | return qe_invalid; | |
| 6459 | } | ||
| 6460 | |||
| 6461 | //section size | ||
| 6462 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetl(&dummy,f)) |
| 6463 | { | ||
| 6464 | ✗ | return qe_invalid; | |
| 6465 | } | ||
| 6466 | |||
| 6467 | //finally... section data | ||
| 6468 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetw(&items_to_read,f)) |
| 6469 | { | ||
| 6470 | ✗ | return qe_invalid; | |
| 6471 | } | ||
| 6472 | |||
| 6473 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if (items_to_read > MAXITEMS) |
| 6474 | { | ||
| 6475 | ✗ | return qe_invalid; | |
| 6476 | } | ||
| 6477 | 473 | } | |
| 6478 | |||
| 6479 |
2/2✓ Branch 0 taken 415 times.
✓ Branch 1 taken 82 times.
|
497 | if(s_version>1) |
| 6480 | { | ||
| 6481 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 415 times.
|
106655 | for(int32_t i=0; i<items_to_read; i++) |
| 6482 | { | ||
| 6483 | char tempname[64]; | ||
| 6484 | |||
| 6485 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(!pfread(tempname, 64, f)) |
| 6486 | { | ||
| 6487 | ✗ | return qe_invalid; | |
| 6488 | } | ||
| 6489 | |||
| 6490 | 106240 | item_string[i][0] = '\0'; | |
| 6491 | 106240 | strncat(item_string[i], tempname, 64 - 1); | |
| 6492 | 106240 | } | |
| 6493 | 415 | } | |
| 6494 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 81 times.
|
82 | else if (!should_skip) |
| 6495 | { | ||
| 6496 |
2/2✓ Branch 0 taken 20736 times.
✓ Branch 1 taken 81 times.
|
20817 | for(int32_t i=0; i<MAXITEMS; i++) |
| 6497 | { | ||
| 6498 | 20736 | reset_itemname(i); | |
| 6499 | 20736 | } | |
| 6500 | 81 | } | |
| 6501 | |||
| 6502 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 496 times.
|
497 | if (!should_skip) |
| 6503 |
2/2✓ Branch 0 taken 126976 times.
✓ Branch 1 taken 496 times.
|
127472 | for(int32_t i=0; i<MAXITEMS; i++) |
| 6504 | { | ||
| 6505 | 126976 | itemdata& id = itemsbuf[i]; | |
| 6506 | 126976 | memset(&id, 0, sizeof(itemdata)); | |
| 6507 | 126976 | id.count=-1; | |
| 6508 | 126976 | id.playsound=WAV_SCALE; | |
| 6509 | 126976 | reset_itembuf(&id,i); | |
| 6510 | 127472 | } | |
| 6511 | |||
| 6512 |
2/2✓ Branch 0 taken 115292 times.
✓ Branch 1 taken 497 times.
|
115789 | for(int32_t i=0; i<items_to_read; i++) |
| 6513 | { | ||
| 6514 | 115292 | tempitem = itemdata(); | |
| 6515 | 115292 | reset_itembuf(&tempitem,i); | |
| 6516 | |||
| 6517 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 60252 times.
|
115292 | if ( s_version > 35 ) //expanded tiles |
| 6518 | { | ||
| 6519 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55040 times.
|
55040 | if(!p_igetl(&tempitem.tile,f)) |
| 6520 | { | ||
| 6521 | ✗ | return qe_invalid; | |
| 6522 | } | ||
| 6523 | 55040 | } | |
| 6524 | else | ||
| 6525 | { | ||
| 6526 |
1/2✓ Branch 0 taken 60252 times.
✗ Branch 1 not taken.
|
60252 | if(!p_igetw(&tempitem.tile,f)) |
| 6527 | { | ||
| 6528 | ✗ | return qe_invalid; | |
| 6529 | } | ||
| 6530 | } | ||
| 6531 | |||
| 6532 |
1/2✓ Branch 0 taken 115292 times.
✗ Branch 1 not taken.
|
115292 | if(!p_getc(&tempitem.misc_flags,f)) |
| 6533 | { | ||
| 6534 | ✗ | return qe_invalid; | |
| 6535 | } | ||
| 6536 | |||
| 6537 |
1/2✓ Branch 0 taken 115292 times.
✗ Branch 1 not taken.
|
115292 | if(!p_getc(&tempitem.csets,f)) |
| 6538 | { | ||
| 6539 | ✗ | return qe_invalid; | |
| 6540 | } | ||
| 6541 | |||
| 6542 |
1/2✓ Branch 0 taken 115292 times.
✗ Branch 1 not taken.
|
115292 | if(!p_getc(&tempitem.frames,f)) |
| 6543 | { | ||
| 6544 | ✗ | return qe_invalid; | |
| 6545 | } | ||
| 6546 | |||
| 6547 |
1/2✓ Branch 0 taken 115292 times.
✗ Branch 1 not taken.
|
115292 | if(!p_getc(&tempitem.speed,f)) |
| 6548 | { | ||
| 6549 | ✗ | return qe_invalid; | |
| 6550 | } | ||
| 6551 | |||
| 6552 |
1/2✓ Branch 0 taken 115292 times.
✗ Branch 1 not taken.
|
115292 | if(!p_getc(&tempitem.delay,f)) |
| 6553 | { | ||
| 6554 | ✗ | return qe_invalid; | |
| 6555 | } | ||
| 6556 | |||
| 6557 |
2/2✓ Branch 0 taken 110300 times.
✓ Branch 1 taken 4992 times.
|
115292 | if(version < 0x193) |
| 6558 | { | ||
| 6559 |
1/2✓ Branch 0 taken 4992 times.
✗ Branch 1 not taken.
|
4992 | if(!p_getc(&padding,f)) |
| 6560 | { | ||
| 6561 | ✗ | return qe_invalid; | |
| 6562 | } | ||
| 6563 | |||
| 6564 |
4/6✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 3456 times.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1536 times.
✗ Branch 5 not taken.
|
4992 | if((version < 0x192)||((version == 0x192)&&(build<186))) |
| 6565 | { | ||
| 6566 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 4736 times.
|
4992 | if (should_skip) |
| 6567 | 256 | continue; | |
| 6568 | |||
| 6569 |
3/3✓ Branch 0 taken 23 times.
✓ Branch 1 taken 4690 times.
✓ Branch 2 taken 23 times.
|
4736 | switch(i) |
| 6570 | { | ||
| 6571 | case iShield: | ||
| 6572 | 23 | tempitem.ltm=get_qr(qr_BSZELDA)?-12:10; | |
| 6573 | 23 | break; | |
| 6574 | |||
| 6575 | case iMShield: | ||
| 6576 | 23 | tempitem.ltm=get_qr(qr_BSZELDA)?-6:-10; | |
| 6577 | 23 | break; | |
| 6578 | |||
| 6579 | default: | ||
| 6580 | 4690 | tempitem.ltm=0; | |
| 6581 | 4690 | break; | |
| 6582 | } | ||
| 6583 | |||
| 6584 | 4736 | tempitem.count=-1; | |
| 6585 | 4736 | tempitem.flags=item_none; | |
| 6586 | 4736 | tempitem.wpn=tempitem.wpn2=tempitem.wpn3=tempitem.wpn3=tempitem.pickup_hearts= | |
| 6587 | 4736 | tempitem.misc1=tempitem.misc2=tempitem.usesound=0; | |
| 6588 | 4736 | tempitem.type=0xFF; | |
| 6589 | 4736 | tempitem.playsound=WAV_SCALE; | |
| 6590 | 4736 | reset_itembuf(&tempitem,i); | |
| 6591 | |||
| 6592 | 4736 | itemsbuf[i] = tempitem; | |
| 6593 | |||
| 6594 | 4736 | continue; | |
| 6595 | } | ||
| 6596 | ✗ | } | |
| 6597 | |||
| 6598 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 110300 times.
|
110300 | if(!p_igetl(&tempitem.ltm,f)) |
| 6599 | { | ||
| 6600 | ✗ | return qe_invalid; | |
| 6601 | } | ||
| 6602 | |||
| 6603 |
1/2✓ Branch 0 taken 110300 times.
✗ Branch 1 not taken.
|
110300 | if(version < 0x193) |
| 6604 | { | ||
| 6605 | ✗ | for(int32_t q=0; q<12; q++) | |
| 6606 | { | ||
| 6607 | ✗ | if(!p_getc(&padding,f)) | |
| 6608 | { | ||
| 6609 | ✗ | return qe_invalid; | |
| 6610 | } | ||
| 6611 | ✗ | } | |
| 6612 | ✗ | } | |
| 6613 | |||
| 6614 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 4060 times.
|
110300 | if(s_version>1) |
| 6615 | { | ||
| 6616 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 51200 times.
|
106240 | if ( s_version >= 31 ) |
| 6617 | { | ||
| 6618 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55040 times.
|
55040 | if(!p_igetl(&tempitem.type,f)) |
| 6619 | { | ||
| 6620 | ✗ | return qe_invalid; | |
| 6621 | } | ||
| 6622 | 55040 | } | |
| 6623 | else | ||
| 6624 | { | ||
| 6625 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 51200 times.
|
51200 | if(!p_getc(&tempitem.type,f)) |
| 6626 | { | ||
| 6627 | ✗ | return qe_invalid; | |
| 6628 | } | ||
| 6629 | } | ||
| 6630 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(s_version < 16) |
| 6631 | ✗ | if(tempitem.type == 0xFF) | |
| 6632 | ✗ | tempitem.type = itype_misc; | |
| 6633 | |||
| 6634 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(!p_getc(&tempitem.level,f)) |
| 6635 | { | ||
| 6636 | ✗ | return qe_invalid; | |
| 6637 | } | ||
| 6638 | |||
| 6639 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(s_version>5) |
| 6640 | { | ||
| 6641 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 51200 times.
|
106240 | if(s_version>=31) |
| 6642 | { | ||
| 6643 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55040 times.
|
55040 | if(!p_igetl(&tempitem.power,f)) |
| 6644 | { | ||
| 6645 | ✗ | return qe_invalid; | |
| 6646 | } | ||
| 6647 | 55040 | } | |
| 6648 | else | ||
| 6649 | { | ||
| 6650 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 51200 times.
|
51200 | if(!p_getc(&tempitem.power,f)) |
| 6651 | { | ||
| 6652 | ✗ | return qe_invalid; | |
| 6653 | } | ||
| 6654 | } | ||
| 6655 | |||
| 6656 | //converted flags from 16b to 32b -Z | ||
| 6657 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 55040 times.
|
106240 | if ( s_version < 41 ) |
| 6658 | { | ||
| 6659 |
1/2✓ Branch 0 taken 51200 times.
✗ Branch 1 not taken.
|
51200 | if(!p_igetw(&tempitem.flags,f)) |
| 6660 | { | ||
| 6661 | ✗ | return qe_invalid; | |
| 6662 | } | ||
| 6663 | 51200 | } | |
| 6664 | else | ||
| 6665 | { | ||
| 6666 |
1/2✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
|
55040 | if(!p_igetl(&tempitem.flags,f)) |
| 6667 | { | ||
| 6668 | ✗ | return qe_invalid; | |
| 6669 | } | ||
| 6670 | } | ||
| 6671 | 106240 | } | |
| 6672 | else | ||
| 6673 | { | ||
| 6674 | //tempitem.power = tempitem.fam_type; | ||
| 6675 | char tempchar; | ||
| 6676 | |||
| 6677 | ✗ | if(!p_getc(&tempchar,f)) | |
| 6678 | { | ||
| 6679 | ✗ | return qe_invalid; | |
| 6680 | } | ||
| 6681 | |||
| 6682 | ✗ | if (tempchar) tempitem.flags |= item_gamedata; | |
| 6683 | } | ||
| 6684 | |||
| 6685 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(!p_igetw(&tempitem.script,f)) |
| 6686 | { | ||
| 6687 | ✗ | return qe_invalid; | |
| 6688 | } | ||
| 6689 | |||
| 6690 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(s_version<=3) |
| 6691 | { | ||
| 6692 | ✗ | if(tempitem.script > NUMSCRIPTITEM) | |
| 6693 | { | ||
| 6694 | ✗ | tempitem.script = 0; | |
| 6695 | ✗ | } | |
| 6696 | ✗ | } | |
| 6697 | |||
| 6698 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(!p_getc(&tempitem.count,f)) |
| 6699 | { | ||
| 6700 | ✗ | return qe_invalid; | |
| 6701 | } | ||
| 6702 | |||
| 6703 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(!p_igetw(&tempitem.amount,f)) |
| 6704 | { | ||
| 6705 | ✗ | return qe_invalid; | |
| 6706 | } | ||
| 6707 | |||
| 6708 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(!p_igetw(&tempitem.collect_script,f)) |
| 6709 | { | ||
| 6710 | ✗ | return qe_invalid; | |
| 6711 | } | ||
| 6712 | |||
| 6713 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(s_version<=3) |
| 6714 | { | ||
| 6715 | ✗ | if(tempitem.collect_script > NUMSCRIPTITEM) | |
| 6716 | { | ||
| 6717 | ✗ | tempitem.collect_script = 0; | |
| 6718 | ✗ | } | |
| 6719 | ✗ | } | |
| 6720 | |||
| 6721 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(!p_igetw(&tempitem.setmax,f)) |
| 6722 | { | ||
| 6723 | ✗ | return qe_invalid; | |
| 6724 | } | ||
| 6725 | |||
| 6726 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(!p_igetw(&tempitem.max,f)) |
| 6727 | { | ||
| 6728 | ✗ | return qe_invalid; | |
| 6729 | } | ||
| 6730 | |||
| 6731 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(!p_getc(&tempitem.playsound,f)) |
| 6732 | { | ||
| 6733 | ✗ | return qe_invalid; | |
| 6734 | } | ||
| 6735 | |||
| 6736 |
2/2✓ Branch 0 taken 849920 times.
✓ Branch 1 taken 106240 times.
|
956160 | for(int32_t j=0; j<8; j++) |
| 6737 | { | ||
| 6738 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 849920 times.
|
849920 | if(!p_igetl(&tempitem.initiald[j],f)) |
| 6739 | { | ||
| 6740 | ✗ | return qe_invalid; | |
| 6741 | } | ||
| 6742 | 849920 | } | |
| 6743 | |||
| 6744 |
2/2✓ Branch 0 taken 212480 times.
✓ Branch 1 taken 106240 times.
|
318720 | for(int32_t j=0; j<2; j++) |
| 6745 | { | ||
| 6746 | byte temp; | ||
| 6747 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_getc(&temp,f)) |
| 6748 | { | ||
| 6749 | ✗ | return qe_invalid; | |
| 6750 | } | ||
| 6751 | 212480 | } | |
| 6752 | |||
| 6753 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(s_version>4) |
| 6754 | { | ||
| 6755 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(s_version>5) |
| 6756 | { | ||
| 6757 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(!p_getc(&tempitem.wpn,f)) |
| 6758 | { | ||
| 6759 | ✗ | return qe_invalid; | |
| 6760 | } | ||
| 6761 | |||
| 6762 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(!p_getc(&tempitem.wpn2,f)) |
| 6763 | { | ||
| 6764 | ✗ | return qe_invalid; | |
| 6765 | } | ||
| 6766 | |||
| 6767 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(!p_getc(&tempitem.wpn3,f)) |
| 6768 | { | ||
| 6769 | ✗ | return qe_invalid; | |
| 6770 | } | ||
| 6771 | |||
| 6772 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(!p_getc(&tempitem.wpn4,f)) |
| 6773 | { | ||
| 6774 | ✗ | return qe_invalid; | |
| 6775 | } | ||
| 6776 | |||
| 6777 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(s_version>=15) |
| 6778 | { | ||
| 6779 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(!p_getc(&tempitem.wpn5,f)) |
| 6780 | { | ||
| 6781 | ✗ | return qe_invalid; | |
| 6782 | } | ||
| 6783 | |||
| 6784 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(!p_getc(&tempitem.wpn6,f)) |
| 6785 | { | ||
| 6786 | ✗ | return qe_invalid; | |
| 6787 | } | ||
| 6788 | |||
| 6789 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(!p_getc(&tempitem.wpn7,f)) |
| 6790 | { | ||
| 6791 | ✗ | return qe_invalid; | |
| 6792 | } | ||
| 6793 | |||
| 6794 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(!p_getc(&tempitem.wpn8,f)) |
| 6795 | { | ||
| 6796 | ✗ | return qe_invalid; | |
| 6797 | } | ||
| 6798 | |||
| 6799 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(!p_getc(&tempitem.wpn9,f)) |
| 6800 | { | ||
| 6801 | ✗ | return qe_invalid; | |
| 6802 | } | ||
| 6803 | |||
| 6804 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(!p_getc(&tempitem.wpn10,f)) |
| 6805 | { | ||
| 6806 | ✗ | return qe_invalid; | |
| 6807 | } | ||
| 6808 | 106240 | } | |
| 6809 | |||
| 6810 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(!p_getc(&tempitem.pickup_hearts,f)) |
| 6811 | { | ||
| 6812 | ✗ | return qe_invalid; | |
| 6813 | } | ||
| 6814 | |||
| 6815 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(s_version<15) |
| 6816 | { | ||
| 6817 | ✗ | if(!p_igetw(&dummy_word,f)) | |
| 6818 | { | ||
| 6819 | ✗ | return qe_invalid; | |
| 6820 | } | ||
| 6821 | |||
| 6822 | ✗ | tempitem.misc1=dummy_word; | |
| 6823 | |||
| 6824 | ✗ | if(!p_igetw(&dummy_word,f)) | |
| 6825 | { | ||
| 6826 | ✗ | return qe_invalid; | |
| 6827 | } | ||
| 6828 | |||
| 6829 | ✗ | tempitem.misc2=dummy_word; | |
| 6830 | ✗ | } | |
| 6831 | else | ||
| 6832 | { | ||
| 6833 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(!p_igetl(&tempitem.misc1,f)) |
| 6834 | { | ||
| 6835 | ✗ | return qe_invalid; | |
| 6836 | } | ||
| 6837 | |||
| 6838 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(!p_igetl(&tempitem.misc2,f)) |
| 6839 | { | ||
| 6840 | ✗ | return qe_invalid; | |
| 6841 | } | ||
| 6842 | |||
| 6843 | // Version 24: sh_ice -> sh_script; previously, all shields could block script weapons | ||
| 6844 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(s_version<24) |
| 6845 | { | ||
| 6846 | ✗ | if(tempitem.type==itype_shield) | |
| 6847 | { | ||
| 6848 | ✗ | tempitem.misc1|=sh_script; | |
| 6849 | ✗ | } | |
| 6850 | ✗ | } | |
| 6851 | } | ||
| 6852 | |||
| 6853 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 55040 times.
|
106240 | if(s_version < 53) |
| 6854 | { | ||
| 6855 | byte tempbyte; | ||
| 6856 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 51200 times.
|
51200 | if(!p_getc(&tempbyte,f)) |
| 6857 | { | ||
| 6858 | ✗ | return qe_invalid; | |
| 6859 | } | ||
| 6860 | 51200 | tempitem.cost_amount[0] = tempbyte; | |
| 6861 | 51200 | } | |
| 6862 | else | ||
| 6863 | { | ||
| 6864 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 55040 times.
|
165120 | for(auto q = 0; q < 2; ++q) |
| 6865 | { | ||
| 6866 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 110080 times.
|
110080 | if(!p_igetw(&tempitem.cost_amount[q],f)) |
| 6867 | { | ||
| 6868 | ✗ | return qe_invalid; | |
| 6869 | } | ||
| 6870 | 110080 | } | |
| 6871 | } | ||
| 6872 | 106240 | } | |
| 6873 | else | ||
| 6874 | { | ||
| 6875 | char tempchar; | ||
| 6876 | |||
| 6877 | ✗ | if(!p_getc(&tempchar,f)) | |
| 6878 | { | ||
| 6879 | ✗ | return qe_invalid; | |
| 6880 | } | ||
| 6881 | |||
| 6882 | ✗ | if (tempchar) tempitem.flags |= item_edible; | |
| 6883 | } | ||
| 6884 | |||
| 6885 | // June 2007: more misc. attributes | ||
| 6886 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(s_version>=12) |
| 6887 | { | ||
| 6888 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(s_version<15) |
| 6889 | { | ||
| 6890 | ✗ | if(!p_igetw(&dummy_word,f)) | |
| 6891 | { | ||
| 6892 | ✗ | return qe_invalid; | |
| 6893 | } | ||
| 6894 | |||
| 6895 | ✗ | tempitem.misc3=dummy_word; | |
| 6896 | |||
| 6897 | ✗ | if(!p_igetw(&dummy_word,f)) | |
| 6898 | { | ||
| 6899 | ✗ | return qe_invalid; | |
| 6900 | } | ||
| 6901 | |||
| 6902 | ✗ | tempitem.misc4=dummy_word; | |
| 6903 | ✗ | } | |
| 6904 | else | ||
| 6905 | { | ||
| 6906 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(!p_igetl(&tempitem.misc3,f)) |
| 6907 | { | ||
| 6908 | ✗ | return qe_invalid; | |
| 6909 | } | ||
| 6910 | |||
| 6911 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(!p_igetl(&tempitem.misc4,f)) |
| 6912 | { | ||
| 6913 | ✗ | return qe_invalid; | |
| 6914 | } | ||
| 6915 | |||
| 6916 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(!p_igetl(&tempitem.misc5,f)) |
| 6917 | { | ||
| 6918 | ✗ | return qe_invalid; | |
| 6919 | } | ||
| 6920 | |||
| 6921 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(!p_igetl(&tempitem.misc6,f)) |
| 6922 | { | ||
| 6923 | ✗ | return qe_invalid; | |
| 6924 | } | ||
| 6925 | |||
| 6926 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(!p_igetl(&tempitem.misc7,f)) |
| 6927 | { | ||
| 6928 | ✗ | return qe_invalid; | |
| 6929 | } | ||
| 6930 | |||
| 6931 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(!p_igetl(&tempitem.misc8,f)) |
| 6932 | { | ||
| 6933 | ✗ | return qe_invalid; | |
| 6934 | } | ||
| 6935 | |||
| 6936 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106240 times.
|
106240 | if(!p_igetl(&tempitem.misc9,f)) |
| 6937 | { | ||
| 6938 | ✗ | return qe_invalid; | |
| 6939 | } | ||
| 6940 | |||
| 6941 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(!p_igetl(&tempitem.misc10,f)) |
| 6942 | { | ||
| 6943 | ✗ | return qe_invalid; | |
| 6944 | } | ||
| 6945 | } | ||
| 6946 | |||
| 6947 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(!p_getc(&tempitem.usesound,f)) |
| 6948 | { | ||
| 6949 | ✗ | return qe_invalid; | |
| 6950 | } | ||
| 6951 | |||
| 6952 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 51200 times.
|
106240 | if(s_version >= 49) |
| 6953 | { | ||
| 6954 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55040 times.
|
55040 | if(!p_getc(&tempitem.usesound2,f)) |
| 6955 | { | ||
| 6956 | ✗ | return qe_invalid; | |
| 6957 | } | ||
| 6958 | 55040 | } | |
| 6959 | 51200 | else tempitem.usesound2 = 0; | |
| 6960 | |||
| 6961 |
3/4✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 55040 times.
✓ Branch 2 taken 51200 times.
✗ Branch 3 not taken.
|
106240 | if(s_version < 50 && tempitem.type == itype_mirror) |
| 6962 | { | ||
| 6963 | //Split continue/dmap warp effect/sfx, port for old | ||
| 6964 | ✗ | tempitem.misc2 = tempitem.misc1; | |
| 6965 | ✗ | tempitem.usesound2 = tempitem.usesound; | |
| 6966 | ✗ | } | |
| 6967 | 106240 | } | |
| 6968 | 106240 | } | |
| 6969 | |||
| 6970 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 55040 times.
|
106240 | if ( s_version >= 26 ) //! New itemdata vars for weapon editor. -Z |
| 6971 | { // temp.useweapon, temp.usedefence, temp.weaprange, temp.weap_pattern[ITEM_MOVEMENT_PATTERNS] | ||
| 6972 |
2/2✓ Branch 0 taken 41728 times.
✓ Branch 1 taken 13312 times.
|
55040 | if(s_version < 63) |
| 6973 | { | ||
| 6974 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13312 times.
|
13312 | if(!p_getc(&tempitem.weap_data.imitate_weapon,f)) |
| 6975 | { | ||
| 6976 | ✗ | return qe_invalid; | |
| 6977 | } | ||
| 6978 |
1/2✓ Branch 0 taken 13312 times.
✗ Branch 1 not taken.
|
13312 | if(!p_getc(&tempitem.weap_data.default_defense,f)) |
| 6979 | { | ||
| 6980 | ✗ | return qe_invalid; | |
| 6981 | } | ||
| 6982 | 13312 | } | |
| 6983 |
1/2✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
|
55040 | if(!p_igetl(&tempitem.weaprange,f)) |
| 6984 | { | ||
| 6985 | ✗ | return qe_invalid; | |
| 6986 | } | ||
| 6987 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55040 times.
|
55040 | if(!p_igetl(&tempitem.weapduration,f)) |
| 6988 | { | ||
| 6989 | ✗ | return qe_invalid; | |
| 6990 | } | ||
| 6991 |
2/2✓ Branch 0 taken 550400 times.
✓ Branch 1 taken 55040 times.
|
605440 | for ( int32_t q = 0; q < ITEM_MOVEMENT_PATTERNS; q++ ) |
| 6992 | { | ||
| 6993 |
1/2✓ Branch 0 taken 550400 times.
✗ Branch 1 not taken.
|
550400 | if(!p_igetl(&tempitem.weap_pattern[q],f)) |
| 6994 | { | ||
| 6995 | ✗ | return qe_invalid; | |
| 6996 | } | ||
| 6997 | 550400 | } | |
| 6998 | 55040 | } | |
| 6999 | |||
| 7000 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 55040 times.
|
106240 | if ( s_version >= 27 ) //! New itemdata vars for weapon editor. -Z |
| 7001 | { // temp.useweapon, temp.usedefence, temp.weaprange, temp.weap_pattern[ITEM_MOVEMENT_PATTERNS] | ||
| 7002 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55040 times.
|
55040 | if(!p_igetl(&tempitem.duplicates,f)) |
| 7003 | { | ||
| 7004 | ✗ | return qe_invalid; | |
| 7005 | } | ||
| 7006 |
2/2✓ Branch 0 taken 41728 times.
✓ Branch 1 taken 13312 times.
|
55040 | if(s_version < 63) |
| 7007 |
2/2✓ Branch 0 taken 106496 times.
✓ Branch 1 taken 13312 times.
|
119808 | for ( int32_t q = 0; q < INITIAL_D; q++ ) |
| 7008 |
1/2✓ Branch 0 taken 106496 times.
✗ Branch 1 not taken.
|
106496 | if(!p_igetl(&tempitem.weap_data.initd[q],f)) |
| 7009 | 13312 | return qe_invalid; | |
| 7010 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 55040 times.
|
165120 | for ( int32_t q = 0; q < 2; q++ ) |
| 7011 | { | ||
| 7012 | byte temp; | ||
| 7013 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 110080 times.
|
110080 | if(!p_getc(&temp,f)) |
| 7014 | { | ||
| 7015 | ✗ | return qe_invalid; | |
| 7016 | } | ||
| 7017 | 110080 | } | |
| 7018 | |||
| 7019 |
1/2✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
|
55040 | if(!p_getc(&tempitem.drawlayer,f)) |
| 7020 | { | ||
| 7021 | ✗ | return qe_invalid; | |
| 7022 | } | ||
| 7023 | |||
| 7024 | |||
| 7025 |
1/2✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
|
55040 | if(!p_igetl(&tempitem.hxofs,f)) |
| 7026 | { | ||
| 7027 | ✗ | return qe_invalid; | |
| 7028 | } | ||
| 7029 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55040 times.
|
55040 | if(!p_igetl(&tempitem.hyofs,f)) |
| 7030 | { | ||
| 7031 | ✗ | return qe_invalid; | |
| 7032 | } | ||
| 7033 |
1/2✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
|
55040 | if(!p_igetl(&tempitem.hxsz,f)) |
| 7034 | { | ||
| 7035 | ✗ | return qe_invalid; | |
| 7036 | } | ||
| 7037 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55040 times.
|
55040 | if(!p_igetl(&tempitem.hysz,f)) |
| 7038 | { | ||
| 7039 | ✗ | return qe_invalid; | |
| 7040 | } | ||
| 7041 |
1/2✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
|
55040 | if(!p_igetl(&tempitem.hzsz,f)) |
| 7042 | { | ||
| 7043 | ✗ | return qe_invalid; | |
| 7044 | } | ||
| 7045 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55040 times.
|
55040 | if(!p_igetl(&tempitem.xofs,f)) |
| 7046 | { | ||
| 7047 | ✗ | return qe_invalid; | |
| 7048 | } | ||
| 7049 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55040 times.
|
55040 | if(!p_igetl(&tempitem.yofs,f)) |
| 7050 | { | ||
| 7051 | ✗ | return qe_invalid; | |
| 7052 | } | ||
| 7053 |
2/2✓ Branch 0 taken 41728 times.
✓ Branch 1 taken 13312 times.
|
55040 | if(s_version < 63) |
| 7054 | { | ||
| 7055 |
1/2✓ Branch 0 taken 13312 times.
✗ Branch 1 not taken.
|
13312 | if(!p_igetl(&tempitem.weap_data.hxofs,f)) |
| 7056 | ✗ | return qe_invalid; | |
| 7057 |
1/2✓ Branch 0 taken 13312 times.
✗ Branch 1 not taken.
|
13312 | if(!p_igetl(&tempitem.weap_data.hyofs,f)) |
| 7058 | ✗ | return qe_invalid; | |
| 7059 |
1/2✓ Branch 0 taken 13312 times.
✗ Branch 1 not taken.
|
13312 | if(!p_igetl(&tempitem.weap_data.hxsz,f)) |
| 7060 | ✗ | return qe_invalid; | |
| 7061 |
1/2✓ Branch 0 taken 13312 times.
✗ Branch 1 not taken.
|
13312 | if(!p_igetl(&tempitem.weap_data.hysz,f)) |
| 7062 | ✗ | return qe_invalid; | |
| 7063 |
1/2✓ Branch 0 taken 13312 times.
✗ Branch 1 not taken.
|
13312 | if(!p_igetl(&tempitem.weap_data.hzsz,f)) |
| 7064 | ✗ | return qe_invalid; | |
| 7065 |
1/2✓ Branch 0 taken 13312 times.
✗ Branch 1 not taken.
|
13312 | if(!p_igetl(&tempitem.weap_data.xofs,f)) |
| 7066 | ✗ | return qe_invalid; | |
| 7067 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13312 times.
|
13312 | if(!p_igetl(&tempitem.weap_data.yofs,f)) |
| 7068 | ✗ | return qe_invalid; | |
| 7069 | 13312 | } | |
| 7070 |
2/2✓ Branch 0 taken 41728 times.
✓ Branch 1 taken 13312 times.
|
55040 | if(s_version < 63) |
| 7071 |
1/2✓ Branch 0 taken 13312 times.
✗ Branch 1 not taken.
|
13312 | if(!p_igetw(&tempitem.weap_data.script,f)) |
| 7072 | ✗ | return qe_invalid; | |
| 7073 |
1/2✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
|
55040 | if(!p_igetl(&tempitem.wpnsprite,f)) |
| 7074 | { | ||
| 7075 | ✗ | return qe_invalid; | |
| 7076 | } | ||
| 7077 | 55040 | auto num_cost_tmr = (s_version > 52 ? 2 : 1); | |
| 7078 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 55040 times.
|
165120 | for(auto q = 0; q < num_cost_tmr; ++q) |
| 7079 | { | ||
| 7080 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 110080 times.
|
110080 | if(!p_igetl(&tempitem.magiccosttimer[q],f)) |
| 7081 | { | ||
| 7082 | ✗ | return qe_invalid; | |
| 7083 | } | ||
| 7084 | 110080 | } | |
| 7085 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55040 times.
|
55040 | for(auto q = num_cost_tmr; q < 2; ++q) |
| 7086 | ✗ | tempitem.magiccosttimer[q] = 0; | |
| 7087 | 55040 | } | |
| 7088 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 55040 times.
|
106240 | if ( s_version >= 28 ) //! New itemdata vars for weapon editor. -Z |
| 7089 | { | ||
| 7090 | //Item Size FLags, TileWidth, TileHeight | ||
| 7091 |
1/2✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
|
55040 | if(!p_igetl(&tempitem.overrideFLAGS,f)) |
| 7092 | { | ||
| 7093 | ✗ | return qe_invalid; | |
| 7094 | } | ||
| 7095 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55040 times.
|
55040 | if(!p_igetl(&tempitem.tilew,f)) |
| 7096 | { | ||
| 7097 | ✗ | return qe_invalid; | |
| 7098 | } | ||
| 7099 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55040 times.
|
55040 | if(!p_igetl(&tempitem.tileh,f)) |
| 7100 | { | ||
| 7101 | ✗ | return qe_invalid; | |
| 7102 | } | ||
| 7103 | 55040 | } | |
| 7104 |
4/4✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 51200 times.
✓ Branch 2 taken 41728 times.
✓ Branch 3 taken 13312 times.
|
106240 | if ( s_version >= 29 && s_version < 63) //! More new vars. |
| 7105 | { | ||
| 7106 |
1/2✓ Branch 0 taken 13312 times.
✗ Branch 1 not taken.
|
13312 | if(!p_igetl(&tempitem.weap_data.override_flags,f)) |
| 7107 | ✗ | return qe_invalid; | |
| 7108 |
1/2✓ Branch 0 taken 13312 times.
✗ Branch 1 not taken.
|
13312 | if(!p_igetl(&tempitem.weap_data.tilew,f)) |
| 7109 | ✗ | return qe_invalid; | |
| 7110 |
1/2✓ Branch 0 taken 13312 times.
✗ Branch 1 not taken.
|
13312 | if(!p_igetl(&tempitem.weap_data.tileh,f)) |
| 7111 | ✗ | return qe_invalid; | |
| 7112 | 13312 | } | |
| 7113 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 55040 times.
|
106240 | if ( s_version >= 30 ) //! More new vars. |
| 7114 | { | ||
| 7115 | //Pickup Type | ||
| 7116 |
1/2✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
|
55040 | if(!p_igetl(&tempitem.pickup,f)) |
| 7117 | { | ||
| 7118 | ✗ | return qe_invalid; | |
| 7119 | } | ||
| 7120 | 55040 | } | |
| 7121 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 55040 times.
|
106240 | if ( s_version >= 32 ) //! More new vars. |
| 7122 | { | ||
| 7123 | //Pickup Type | ||
| 7124 |
1/2✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
|
55040 | if(!p_igetw(&tempitem.pstring,f)) |
| 7125 | { | ||
| 7126 | ✗ | return qe_invalid; | |
| 7127 | } | ||
| 7128 | 55040 | } | |
| 7129 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 55040 times.
|
106240 | if ( s_version >= 33 ) //! More new vars. |
| 7130 | { | ||
| 7131 | //Pickup Type | ||
| 7132 |
1/2✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
|
55040 | if(!p_igetw(&tempitem.pickup_string_flags,f)) |
| 7133 | { | ||
| 7134 | ✗ | return qe_invalid; | |
| 7135 | } | ||
| 7136 | 55040 | } | |
| 7137 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 55040 times.
|
106240 | if ( s_version >= 34 ) //! cost counter |
| 7138 | { | ||
| 7139 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55040 times.
|
55040 | if(s_version < 53) |
| 7140 | { | ||
| 7141 | ✗ | if(!p_getc(&tempitem.cost_counter[0],f)) | |
| 7142 | { | ||
| 7143 | ✗ | return qe_invalid; | |
| 7144 | } | ||
| 7145 | ✗ | } | |
| 7146 | else | ||
| 7147 | { | ||
| 7148 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 55040 times.
|
165120 | for(auto q = 0; q < 2; ++q) |
| 7149 | { | ||
| 7150 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_getc(&tempitem.cost_counter[q],f)) |
| 7151 | { | ||
| 7152 | ✗ | return qe_invalid; | |
| 7153 | } | ||
| 7154 | 110080 | } | |
| 7155 | } | ||
| 7156 | 55040 | } | |
| 7157 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 55040 times.
|
106240 | if ( s_version >= 44 ) //! sprite scripts |
| 7158 | { | ||
| 7159 |
2/2✓ Branch 0 taken 440320 times.
✓ Branch 1 taken 55040 times.
|
495360 | for ( int32_t q = 0; q < 8; q++ ) |
| 7160 | { | ||
| 7161 |
2/2✓ Branch 0 taken 28620800 times.
✓ Branch 1 taken 440320 times.
|
29061120 | for ( int32_t w = 0; w < 65; w++ ) |
| 7162 | { | ||
| 7163 |
1/2✓ Branch 0 taken 28620800 times.
✗ Branch 1 not taken.
|
28620800 | if(!p_getc(&(tempitem.initD_label[q][w]),f)) |
| 7164 | { | ||
| 7165 | ✗ | return qe_invalid; | |
| 7166 | } | ||
| 7167 | 28620800 | } | |
| 7168 |
2/2✓ Branch 0 taken 333824 times.
✓ Branch 1 taken 106496 times.
|
440320 | if(s_version < 63) |
| 7169 |
2/2✓ Branch 0 taken 6922240 times.
✓ Branch 1 taken 106496 times.
|
7028736 | for ( int32_t w = 0; w < 65; w++ ) |
| 7170 |
1/2✓ Branch 0 taken 6922240 times.
✗ Branch 1 not taken.
|
6922240 | if(!p_getc(&padding,f)) |
| 7171 | 106496 | return qe_invalid; | |
| 7172 |
2/2✓ Branch 0 taken 28620800 times.
✓ Branch 1 taken 440320 times.
|
29061120 | for ( int32_t w = 0; w < 65; w++ ) |
| 7173 | { | ||
| 7174 |
1/2✓ Branch 0 taken 28620800 times.
✗ Branch 1 not taken.
|
28620800 | if(!p_getc(&(tempitem.sprite_initD_label[q][w]),f)) |
| 7175 | { | ||
| 7176 | ✗ | return qe_invalid; | |
| 7177 | } | ||
| 7178 | 28620800 | } | |
| 7179 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 440320 times.
|
440320 | if(!p_igetl(&(tempitem.sprite_initiald[q]),f)) |
| 7180 | { | ||
| 7181 | ✗ | return qe_invalid; | |
| 7182 | } | ||
| 7183 | |||
| 7184 | 440320 | } | |
| 7185 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 55040 times.
|
165120 | for ( int32_t q = 0; q < 2; q++ ) |
| 7186 | { | ||
| 7187 | byte temp; | ||
| 7188 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_getc(&temp,f)) |
| 7189 | { | ||
| 7190 | ✗ | return qe_invalid; | |
| 7191 | } | ||
| 7192 | 110080 | } | |
| 7193 | //Pickup Type | ||
| 7194 |
1/2✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
|
55040 | if(!p_igetw(&tempitem.sprite_script,f)) |
| 7195 | { | ||
| 7196 | ✗ | return qe_invalid; | |
| 7197 | } | ||
| 7198 | 55040 | } | |
| 7199 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 55040 times.
|
106240 | if ( s_version >= 48 ) //! pickup flags |
| 7200 | { | ||
| 7201 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55040 times.
|
55040 | if(!p_getc(&(tempitem.pickupflag),f)) |
| 7202 | { | ||
| 7203 | ✗ | return qe_invalid; | |
| 7204 | } | ||
| 7205 | 55040 | } | |
| 7206 |
2/2✓ Branch 0 taken 54528 times.
✓ Branch 1 taken 51712 times.
|
106240 | if ( s_version >= 57 ) |
| 7207 | { | ||
| 7208 | 51712 | std::string str; | |
| 7209 |
2/4✓ Branch 0 taken 51712 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 51712 times.
✗ Branch 3 not taken.
|
51712 | if(!p_getcstr(&str,f)) |
| 7210 | ✗ | return qe_invalid; | |
| 7211 | 51712 | strncpy(tempitem.display_name,str.c_str(),255); | |
| 7212 |
1/3✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 51712 times.
|
51712 | } |
| 7213 | 106240 | } | |
| 7214 | else | ||
| 7215 | { | ||
| 7216 | 4060 | tempitem.count=-1; | |
| 7217 | 4060 | tempitem.type=itype_misc; | |
| 7218 | 4060 | tempitem.flags=item_none; | |
| 7219 | 4060 | tempitem.wpn=tempitem.wpn2=tempitem.wpn3=tempitem.wpn3=tempitem.pickup_hearts=tempitem.misc1=tempitem.misc2=tempitem.usesound=0; | |
| 7220 | 4060 | tempitem.playsound=WAV_SCALE; | |
| 7221 | 4060 | reset_itembuf(&tempitem,i); | |
| 7222 | } | ||
| 7223 | |||
| 7224 |
4/4✓ Branch 0 taken 50688 times.
✓ Branch 1 taken 59612 times.
✓ Branch 2 taken 41728 times.
✓ Branch 3 taken 8960 times.
|
110300 | if(s_version >= 58 && s_version < 63) |
| 7225 | { | ||
| 7226 |
2/2✓ Branch 0 taken 44800 times.
✓ Branch 1 taken 8960 times.
|
53760 | for(int q = 0; q < WPNSPR_MAX; ++q) |
| 7227 | { | ||
| 7228 |
1/2✓ Branch 0 taken 44800 times.
✗ Branch 1 not taken.
|
44800 | if(!p_getc(&tempitem.weap_data.burnsprs[q],f)) |
| 7229 | ✗ | return qe_invalid; | |
| 7230 |
2/2✓ Branch 0 taken 1280 times.
✓ Branch 1 taken 43520 times.
|
44800 | if(s_version >= 59) |
| 7231 |
1/2✓ Branch 0 taken 43520 times.
✗ Branch 1 not taken.
|
43520 | if(!p_getc(&tempitem.weap_data.light_rads[q],f)) |
| 7232 | ✗ | return qe_invalid; | |
| 7233 | 44800 | } | |
| 7234 | 8960 | } | |
| 7235 | |||
| 7236 |
2/2✓ Branch 0 taken 67036 times.
✓ Branch 1 taken 43264 times.
|
110300 | if ( s_version >= 60 ) |
| 7237 | { | ||
| 7238 |
2/2✓ Branch 0 taken 39168 times.
✓ Branch 1 taken 4096 times.
|
43264 | if ( s_version >= 65 ) |
| 7239 | { | ||
| 7240 |
1/2✓ Branch 0 taken 39168 times.
✗ Branch 1 not taken.
|
39168 | if(!p_igetw(&tempitem.pickup_litems,f)) |
| 7241 | ✗ | return qe_invalid; | |
| 7242 | 39168 | } | |
| 7243 | else | ||
| 7244 | { | ||
| 7245 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_getc(&padding,f)) |
| 7246 | ✗ | return qe_invalid; | |
| 7247 | 4096 | tempitem.pickup_litems = word(padding); | |
| 7248 | } | ||
| 7249 |
1/2✓ Branch 0 taken 43264 times.
✗ Branch 1 not taken.
|
43264 | if(!p_igetw(&tempitem.pickup_litem_level,f)) |
| 7250 | ✗ | return qe_invalid; | |
| 7251 | 43264 | } | |
| 7252 | |||
| 7253 |
2/2✓ Branch 0 taken 43264 times.
✓ Branch 1 taken 67036 times.
|
110300 | if ( s_version >= 62 ) |
| 7254 | { | ||
| 7255 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 43264 times.
|
43264 | if (!p_igetl(&tempitem.moveflags, f)) |
| 7256 | ✗ | return qe_invalid; | |
| 7257 |
2/2✓ Branch 0 taken 41728 times.
✓ Branch 1 taken 1536 times.
|
43264 | if(s_version < 63) |
| 7258 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1536 times.
|
1536 | if (!p_igetl(&tempitem.weap_data.moveflags, f)) |
| 7259 | ✗ | return qe_invalid; | |
| 7260 | 43264 | } | |
| 7261 | else | ||
| 7262 | { | ||
| 7263 | 67036 | tempitem.moveflags = (move_obeys_grav | move_can_pitfall); | |
| 7264 |
3/3✓ Branch 0 taken 1926 times.
✓ Branch 1 taken 64809 times.
✓ Branch 2 taken 301 times.
|
67036 | switch(tempitem.type) |
| 7265 | { | ||
| 7266 | case itype_divinefire: | ||
| 7267 |
2/2✓ Branch 0 taken 167 times.
✓ Branch 1 taken 134 times.
|
301 | if(!(tempitem.flags & item_flag3)) |
| 7268 | 134 | break; | |
| 7269 | [[fallthrough]]; | ||
| 7270 | case itype_bomb: case itype_sbomb: | ||
| 7271 | case itype_bait: case itype_liftglove: | ||
| 7272 | case itype_candle: case itype_book: | ||
| 7273 | 2093 | tempitem.weap_data.moveflags = (move_obeys_grav | move_can_pitfall); | |
| 7274 | 2093 | break; | |
| 7275 | default: | ||
| 7276 | 64809 | tempitem.weap_data.moveflags = move_none; | |
| 7277 | 64809 | break; | |
| 7278 | } | ||
| 7279 | } | ||
| 7280 | |||
| 7281 |
2/2✓ Branch 0 taken 41728 times.
✓ Branch 1 taken 68572 times.
|
110300 | if(s_version >= 63) |
| 7282 | { | ||
| 7283 |
1/2✓ Branch 0 taken 41728 times.
✗ Branch 1 not taken.
|
41728 | if(auto ret = read_weap_data(tempitem.weap_data, f)) |
| 7284 | ✗ | return ret; | |
| 7285 | 41728 | } | |
| 7286 | else | ||
| 7287 | { | ||
| 7288 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 68554 times.
|
68572 | SETFLAG(tempitem.weap_data.wflags, WFLAG_UPDATE_IGNITE_SPRITE, tempitem.flags & item_burning_sprites); |
| 7289 |
3/3✓ Branch 0 taken 630 times.
✓ Branch 1 taken 67876 times.
✓ Branch 2 taken 66 times.
|
68572 | switch(tempitem.type) |
| 7290 | { | ||
| 7291 | case itype_liftglove: | ||
| 7292 | 66 | tempitem.weap_data.wflags = WFLAG_BREAK_WHEN_LANDING; | |
| 7293 | 66 | break; | |
| 7294 | case itype_bomb: case itype_sbomb: | ||
| 7295 | // Moving these over and removing them from itemdata | ||
| 7296 |
2/2✓ Branch 0 taken 606 times.
✓ Branch 1 taken 24 times.
|
630 | if(tempitem.flags & item_flag3) |
| 7297 | 24 | tempitem.weap_data.wflags |= WFLAG_STOP_WHEN_LANDING; | |
| 7298 |
2/2✓ Branch 0 taken 606 times.
✓ Branch 1 taken 24 times.
|
630 | if(tempitem.flags & item_flag5) |
| 7299 | 24 | tempitem.weap_data.wflags |= WFLAG_STOP_WHEN_HIT_SOLID; | |
| 7300 | 630 | tempitem.flags &= ~(item_flag3|item_flag5); | |
| 7301 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 18 times.
|
630 | if(tempitem.misc4) |
| 7302 | { | ||
| 7303 | 18 | tempitem.weap_data.lift_level = tempitem.misc4; | |
| 7304 | 18 | tempitem.weap_data.lift_time = tempitem.misc5; | |
| 7305 | 18 | tempitem.weap_data.lift_height = tempitem.misc6; | |
| 7306 | 18 | tempitem.misc4 = 0; | |
| 7307 | 18 | tempitem.misc5 = 0; | |
| 7308 | 18 | tempitem.misc6 = 0; | |
| 7309 | 18 | } | |
| 7310 | 630 | break; | |
| 7311 | } | ||
| 7312 | } | ||
| 7313 | |||
| 7314 |
2/2✓ Branch 0 taken 71132 times.
✓ Branch 1 taken 39168 times.
|
110300 | if (s_version >= 64) |
| 7315 | { | ||
| 7316 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 39168 times.
|
39168 | if (!p_igetl(&tempitem.cooldown, f)) |
| 7317 | ✗ | return qe_invalid; | |
| 7318 | 39168 | } | |
| 7319 | |||
| 7320 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 110300 times.
|
110300 | if (!should_skip) |
| 7321 | { | ||
| 7322 |
1/2✓ Branch 0 taken 110300 times.
✗ Branch 1 not taken.
|
110300 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 7323 | { | ||
| 7324 | ✗ | tempitem.script = 0; | |
| 7325 | ✗ | tempitem.weap_data.script = 0; | |
| 7326 | ✗ | for(int q = 0; q < 8; ++q) | |
| 7327 | { | ||
| 7328 | ✗ | tempitem.initiald[q] = 0; | |
| 7329 | ✗ | tempitem.weap_data.initd[q] = 0; | |
| 7330 | ✗ | } | |
| 7331 | ✗ | } | |
| 7332 | 110300 | itemsbuf[i] = tempitem; | |
| 7333 | 110300 | } | |
| 7334 | 110300 | } | |
| 7335 | |||
| 7336 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 496 times.
|
497 | if (should_skip) |
| 7337 | 1 | return 0; | |
| 7338 | |||
| 7339 | ////////////////////////////////////////////////////// | ||
| 7340 | // Now do any updates because of new item additions | ||
| 7341 | // (These can't be done above because items_to_read | ||
| 7342 | // might be too low.) | ||
| 7343 | ////////////////////////////////////////////////////// | ||
| 7344 |
2/2✓ Branch 0 taken 126976 times.
✓ Branch 1 taken 496 times.
|
127472 | for(int32_t i=0; i<MAXITEMS; i++) |
| 7345 | { | ||
| 7346 | 126976 | tempitem = itemsbuf[i]; | |
| 7347 | |||
| 7348 | //Account for older quests that didn't have an actual item for the used letter | ||
| 7349 |
4/4✓ Branch 0 taken 20736 times.
✓ Branch 1 taken 106240 times.
✓ Branch 2 taken 20655 times.
✓ Branch 3 taken 81 times.
|
126976 | if(s_version < 2 && i==iLetterUsed) |
| 7350 | { | ||
| 7351 | 81 | reset_itembuf(&tempitem, iLetterUsed); | |
| 7352 | 81 | strcpy(item_string[i],old_item_string[i]); | |
| 7353 | 81 | tempitem.tile = itemsbuf[iLetter].tile; | |
| 7354 | 81 | tempitem.csets = itemsbuf[iLetter].csets; | |
| 7355 | 81 | tempitem.misc_flags = itemsbuf[iLetter].misc_flags; | |
| 7356 | 81 | tempitem.frames = itemsbuf[iLetter].frames; | |
| 7357 | 81 | tempitem.speed = itemsbuf[iLetter].speed; | |
| 7358 | 81 | tempitem.ltm = itemsbuf[iLetter].ltm; | |
| 7359 | 81 | } | |
| 7360 | |||
| 7361 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 20736 times.
|
126976 | if(s_version < 3) |
| 7362 | { | ||
| 7363 |
3/3✓ Branch 0 taken 1782 times.
✓ Branch 1 taken 18873 times.
✓ Branch 2 taken 81 times.
|
20736 | switch(i) |
| 7364 | { | ||
| 7365 | case iRocsFeather: | ||
| 7366 | case iHoverBoots: | ||
| 7367 | case iSpinScroll: | ||
| 7368 | case iL2SpinScroll: | ||
| 7369 | case iCrossScroll: | ||
| 7370 | case iQuakeScroll: | ||
| 7371 | case iL2QuakeScroll: | ||
| 7372 | case iWhispRing: | ||
| 7373 | case iL2WhispRing: | ||
| 7374 | case iChargeRing: | ||
| 7375 | case iL2ChargeRing: | ||
| 7376 | case iPerilScroll: | ||
| 7377 | case iWalletL3: | ||
| 7378 | case iQuiverL4: | ||
| 7379 | case iBombBagL4: | ||
| 7380 | case iBracelet: | ||
| 7381 | case iL2Bracelet: | ||
| 7382 | case iOldGlove: | ||
| 7383 | case iL2Ladder: | ||
| 7384 | case iWealthMedal: | ||
| 7385 | case iL2WealthMedal: | ||
| 7386 | case iL3WealthMedal: | ||
| 7387 | 1782 | reset_itembuf(&tempitem, i); | |
| 7388 | 1782 | strcpy(item_string[i],old_item_string[i]); | |
| 7389 | 1782 | break; | |
| 7390 | |||
| 7391 | case iSShield: | ||
| 7392 | 81 | reset_itembuf(&tempitem, i); | |
| 7393 | 81 | strcpy(item_string[i],old_item_string[i]); | |
| 7394 | 81 | strcpy(item_string[iShield],old_item_string[iShield]); | |
| 7395 | 81 | strcpy(item_string[iMShield],old_item_string[iMShield]); | |
| 7396 | 81 | break; | |
| 7397 | } | ||
| 7398 | 20736 | } | |
| 7399 | |||
| 7400 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 20736 times.
|
126976 | if(s_version < 5) |
| 7401 | { | ||
| 7402 |
2/2✓ Branch 0 taken 567 times.
✓ Branch 1 taken 20169 times.
|
20736 | switch(i) |
| 7403 | { | ||
| 7404 | case iHeartRing: | ||
| 7405 | case iL2HeartRing: | ||
| 7406 | case iL3HeartRing: | ||
| 7407 | case iMagicRing: | ||
| 7408 | case iL2MagicRing: | ||
| 7409 | case iL3MagicRing: | ||
| 7410 | case iL4MagicRing: | ||
| 7411 | 567 | reset_itembuf(&tempitem, i); | |
| 7412 | 567 | strcpy(item_string[i],old_item_string[i]); | |
| 7413 | 567 | break; | |
| 7414 | } | ||
| 7415 | 20736 | } | |
| 7416 | |||
| 7417 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 20736 times.
|
126976 | if(s_version < 6) // April 2007: Advanced item editing capabilities. |
| 7418 | { | ||
| 7419 |
4/4✓ Branch 0 taken 20655 times.
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 81 times.
✓ Branch 3 taken 20574 times.
|
20736 | if(i!=iBPotion && i!=iRPotion) |
| 7420 |
2/2✓ Branch 0 taken 19050 times.
✓ Branch 1 taken 1524 times.
|
20574 | if (get_bit(deprecated_rules,32)) tempitem.flags |= item_keep_old; |
| 7421 | |||
| 7422 |
43/43✓ Branch 0 taken 81 times.
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 81 times.
✓ Branch 3 taken 81 times.
✓ Branch 4 taken 81 times.
✓ Branch 5 taken 81 times.
✓ Branch 6 taken 81 times.
✓ Branch 7 taken 81 times.
✓ Branch 8 taken 81 times.
✓ Branch 9 taken 81 times.
✓ Branch 10 taken 324 times.
✓ Branch 11 taken 17091 times.
✓ Branch 12 taken 81 times.
✓ Branch 13 taken 81 times.
✓ Branch 14 taken 81 times.
✓ Branch 15 taken 81 times.
✓ Branch 16 taken 81 times.
✓ Branch 17 taken 81 times.
✓ Branch 18 taken 81 times.
✓ Branch 19 taken 81 times.
✓ Branch 20 taken 81 times.
✓ Branch 21 taken 81 times.
✓ Branch 22 taken 81 times.
✓ Branch 23 taken 81 times.
✓ Branch 24 taken 81 times.
✓ Branch 25 taken 81 times.
✓ Branch 26 taken 81 times.
✓ Branch 27 taken 81 times.
✓ Branch 28 taken 81 times.
✓ Branch 29 taken 81 times.
✓ Branch 30 taken 81 times.
✓ Branch 31 taken 81 times.
✓ Branch 32 taken 81 times.
✓ Branch 33 taken 81 times.
✓ Branch 34 taken 81 times.
✓ Branch 35 taken 81 times.
✓ Branch 36 taken 81 times.
✓ Branch 37 taken 81 times.
✓ Branch 38 taken 81 times.
✓ Branch 39 taken 81 times.
✓ Branch 40 taken 81 times.
✓ Branch 41 taken 81 times.
✓ Branch 42 taken 81 times.
|
20736 | switch(i) |
| 7423 | { | ||
| 7424 | case iTriforce: | ||
| 7425 | 81 | tempitem.level=1; | |
| 7426 | 81 | break; | |
| 7427 | |||
| 7428 | case iBigTri: | ||
| 7429 | 81 | tempitem.level=0; | |
| 7430 | 81 | break; | |
| 7431 | |||
| 7432 | case iBombs: | ||
| 7433 | 81 | tempitem.level=i_bomb; | |
| 7434 | 81 | tempitem.power=4; | |
| 7435 | 81 | tempitem.wpn=wBOMB; | |
| 7436 | 81 | tempitem.wpn2=wBOOM; | |
| 7437 | 81 | tempitem.misc1 = 50; | |
| 7438 | |||
| 7439 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 81 times.
|
81 | if(get_bit(deprecated_rules,qr_SLOWBOMBFUSES_DEP)) tempitem.misc1 = 200; |
| 7440 | |||
| 7441 | 81 | break; | |
| 7442 | |||
| 7443 | case iSBomb: | ||
| 7444 | 81 | tempitem.level=i_sbomb; | |
| 7445 | 81 | tempitem.power=16; | |
| 7446 | 81 | tempitem.wpn=wSBOMB; | |
| 7447 | 81 | tempitem.wpn2=wSBOOM; | |
| 7448 | 81 | tempitem.misc1 = 50; | |
| 7449 | |||
| 7450 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 81 times.
|
81 | if(get_bit(deprecated_rules,qr_SLOWBOMBFUSES_DEP)) tempitem.misc1 = 400; |
| 7451 | |||
| 7452 | 81 | break; | |
| 7453 | |||
| 7454 | case iBook: | ||
| 7455 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 81 times.
|
81 | if(get_bit(deprecated_rules, qr_FIREMAGICSPRITE_DEP)) |
| 7456 | ✗ | tempitem.wpn = wFIREMAGIC; | |
| 7457 | |||
| 7458 | 81 | break; | |
| 7459 | |||
| 7460 | case iSArrow: | ||
| 7461 | 81 | tempitem.wpn2 = get_bit(deprecated_rules,27) ? wSSPARKLE : 0; //qr_SASPARKLES | |
| 7462 | 81 | tempitem.power=4; | |
| 7463 | 81 | tempitem.flags|=item_gamedata; | |
| 7464 | 81 | tempitem.wpn=wSARROW; | |
| 7465 | 81 | break; | |
| 7466 | |||
| 7467 | case iGArrow: | ||
| 7468 | 81 | tempitem.wpn2 = get_bit(deprecated_rules,28) ? wGSPARKLE : 0; //qr_GASPARKLES | |
| 7469 | 81 | tempitem.power=8; | |
| 7470 | 81 | tempitem.flags|=(item_gamedata|item_flag1); | |
| 7471 | 81 | tempitem.wpn=wGARROW; | |
| 7472 | 81 | break; | |
| 7473 | |||
| 7474 | case iBrang: | ||
| 7475 | 81 | tempitem.power=0; | |
| 7476 | 81 | tempitem.wpn=wBRANG; | |
| 7477 | 81 | tempitem.misc1=36; | |
| 7478 | 81 | break; | |
| 7479 | |||
| 7480 | case iMBrang: | ||
| 7481 | 81 | tempitem.wpn2 = get_bit(deprecated_rules,29) ? wMSPARKLE : 0; //qr_MBSPARKLES | |
| 7482 | 81 | tempitem.power=0; | |
| 7483 | 81 | tempitem.wpn=wMBRANG; | |
| 7484 | 81 | break; | |
| 7485 | |||
| 7486 | case iFBrang: | ||
| 7487 | 81 | tempitem.wpn3 = get_bit(deprecated_rules,30) ? wFSPARKLE : 0; //qr_FBSPARKLES | |
| 7488 | 81 | tempitem.power=2; | |
| 7489 | 81 | tempitem.wpn=wFBRANG; | |
| 7490 | 81 | break; | |
| 7491 | |||
| 7492 | case iBoots: | ||
| 7493 | 81 | tempitem.cost_amount[0] = get_bit(deprecated_rules,qr_MAGICBOOTS_DEP) ? 1 : 0; | |
| 7494 | 81 | tempitem.power=7; | |
| 7495 | 81 | break; | |
| 7496 | |||
| 7497 | case iWand: | ||
| 7498 | 81 | tempitem.cost_amount[0] = get_bit(deprecated_rules,qr_MAGICWAND_DEP) ? 8 : 0; | |
| 7499 | 81 | tempitem.power=2; | |
| 7500 | 81 | tempitem.wpn=wWAND; | |
| 7501 | 81 | tempitem.wpn3=wMAGIC; | |
| 7502 | 81 | break; | |
| 7503 | |||
| 7504 | case iBCandle: | ||
| 7505 | 81 | tempitem.cost_amount[0] = get_bit(deprecated_rules,qr_MAGICCANDLE_DEP) ? 4 : 0; | |
| 7506 | 81 | tempitem.power=1; | |
| 7507 | 81 | tempitem.flags|=(item_gamedata|item_flag1); | |
| 7508 | 81 | tempitem.wpn3=wFIRE; | |
| 7509 | 81 | break; | |
| 7510 | |||
| 7511 | case iRCandle: | ||
| 7512 | 81 | tempitem.cost_amount[0] = get_bit(deprecated_rules,qr_MAGICCANDLE_DEP) ? 4 : 0; | |
| 7513 | 81 | tempitem.power=1; | |
| 7514 | 81 | tempitem.wpn3=wFIRE; | |
| 7515 | 81 | break; | |
| 7516 | |||
| 7517 | case iSword: | ||
| 7518 | 81 | tempitem.power=1; | |
| 7519 | 81 | tempitem.flags|= item_flag4 |item_flag2; | |
| 7520 | 81 | tempitem.wpn=tempitem.wpn3=wSWORD; | |
| 7521 | 81 | tempitem.wpn2=wSWORDSLASH; | |
| 7522 | 81 | break; | |
| 7523 | |||
| 7524 | case iWSword: | ||
| 7525 | 81 | tempitem.power=2; | |
| 7526 | 81 | tempitem.flags|= item_flag4 |item_flag2; | |
| 7527 | 81 | tempitem.wpn=tempitem.wpn3=wWSWORD; | |
| 7528 | 81 | tempitem.wpn2=wWSWORDSLASH; | |
| 7529 | 81 | break; | |
| 7530 | |||
| 7531 | case iMSword: | ||
| 7532 | 81 | tempitem.power=4; | |
| 7533 | 81 | tempitem.flags|= item_flag4 |item_flag2; | |
| 7534 | 81 | tempitem.wpn=tempitem.wpn3=wMSWORD; | |
| 7535 | 81 | tempitem.wpn2=wMSWORDSLASH; | |
| 7536 | 81 | break; | |
| 7537 | |||
| 7538 | case iXSword: | ||
| 7539 | 81 | tempitem.power=8; | |
| 7540 | 81 | tempitem.flags|= item_flag4 |item_flag2; | |
| 7541 | 81 | tempitem.wpn=tempitem.wpn3=wXSWORD; | |
| 7542 | 81 | tempitem.wpn2=wXSWORDSLASH; | |
| 7543 | 81 | break; | |
| 7544 | |||
| 7545 | case iDivineProtection: | ||
| 7546 | 81 | tempitem.flags |= get_bit(deprecated_rules,qr_FLICKERINGDIVINEPROTECTIONROCKET_DEP) ? item_flag1 : item_none; | |
| 7547 | 81 | tempitem.flags |= get_bit(deprecated_rules,qr_TRANSLUCENTDIVINEPROTECTIONROCKET_DEP) ? item_flag2 : item_none; | |
| 7548 | 81 | tempitem.wpn=wDIVINEPROTECTION1A; | |
| 7549 | 81 | tempitem.wpn2=wDIVINEPROTECTION1B; | |
| 7550 | 81 | tempitem.wpn3=wDIVINEPROTECTIONS1A; | |
| 7551 | 81 | tempitem.wpn4=wDIVINEPROTECTIONS1B; | |
| 7552 | 81 | tempitem.wpn6=wDIVINEPROTECTION2A; | |
| 7553 | 81 | tempitem.wpn7=wDIVINEPROTECTION2B; | |
| 7554 | 81 | tempitem.wpn8=wDIVINEPROTECTIONS2A; | |
| 7555 | 81 | tempitem.wpn9=wDIVINEPROTECTIONS2B; | |
| 7556 | 81 | tempitem.wpn5 = iwDivineProtectionShieldFront; | |
| 7557 | 81 | tempitem.wpn10 = iwDivineProtectionShieldBack; | |
| 7558 | 81 | tempitem.misc1=512; | |
| 7559 | 81 | tempitem.cost_amount[0]=64; | |
| 7560 | 81 | break; | |
| 7561 | |||
| 7562 | case iLens: | ||
| 7563 | 81 | tempitem.misc1=60; | |
| 7564 | 81 | tempitem.flags |= get_qr(qr_ENABLEMAGIC) ? item_none : item_rupee_magic; | |
| 7565 | 81 | tempitem.cost_amount[0] = get_qr(qr_ENABLEMAGIC) ? 2 : 1; | |
| 7566 | 81 | break; | |
| 7567 | |||
| 7568 | case iArrow: | ||
| 7569 | 81 | tempitem.power=2; | |
| 7570 | 81 | tempitem.wpn=wARROW; | |
| 7571 | 81 | break; | |
| 7572 | |||
| 7573 | case iHoverBoots: | ||
| 7574 | 81 | tempitem.misc1=45; | |
| 7575 | 81 | tempitem.wpn=iwHover; | |
| 7576 | 81 | break; | |
| 7577 | |||
| 7578 | case iDivineFire: | ||
| 7579 | 81 | tempitem.power=8; | |
| 7580 | 81 | tempitem.wpn=wDIVINEFIRE1A; | |
| 7581 | 81 | tempitem.wpn2=wDIVINEFIRE1B; | |
| 7582 | 81 | tempitem.wpn3=wDIVINEFIRES1A; | |
| 7583 | 81 | tempitem.wpn4=wDIVINEFIRES1B; | |
| 7584 | 81 | tempitem.misc1 = 32; | |
| 7585 | 81 | tempitem.misc2 = 200; | |
| 7586 | 81 | tempitem.cost_amount[0]=32; | |
| 7587 | 81 | break; | |
| 7588 | |||
| 7589 | case iDivineEscape: | ||
| 7590 | 81 | tempitem.cost_amount[0]=32; | |
| 7591 | 81 | break; | |
| 7592 | |||
| 7593 | case iHookshot: | ||
| 7594 | 81 | tempitem.power=0; | |
| 7595 | 81 | tempitem.flags&=~item_flag1; | |
| 7596 | 81 | tempitem.wpn=wHSHEAD; | |
| 7597 | 81 | tempitem.wpn2=wHSCHAIN_H; | |
| 7598 | 81 | tempitem.wpn4=wHSHANDLE; | |
| 7599 | 81 | tempitem.wpn3=wHSCHAIN_V; | |
| 7600 | 81 | tempitem.misc1=50; | |
| 7601 | 81 | tempitem.misc2=100; | |
| 7602 | 81 | break; | |
| 7603 | |||
| 7604 | case iLongshot: | ||
| 7605 | 81 | tempitem.power=0; | |
| 7606 | 81 | tempitem.flags&=~item_flag1; | |
| 7607 | 81 | tempitem.wpn=wLSHEAD; | |
| 7608 | 81 | tempitem.wpn2=wLSCHAIN_H; | |
| 7609 | 81 | tempitem.wpn4=wLSHANDLE; | |
| 7610 | 81 | tempitem.wpn3=wLSCHAIN_V; | |
| 7611 | 81 | tempitem.misc1=99; | |
| 7612 | 81 | tempitem.misc2=100; | |
| 7613 | 81 | break; | |
| 7614 | |||
| 7615 | case iHammer: | ||
| 7616 | 81 | tempitem.power=4; | |
| 7617 | 81 | tempitem.wpn=wHAMMER; | |
| 7618 | 81 | tempitem.wpn2=iwHammerSmack; | |
| 7619 | 81 | break; | |
| 7620 | |||
| 7621 | case iCByrna: | ||
| 7622 | 81 | tempitem.power=1; | |
| 7623 | 81 | tempitem.wpn=wCBYRNA; | |
| 7624 | 81 | tempitem.wpn2=wCBYRNASLASH; | |
| 7625 | 81 | tempitem.wpn3=wCBYRNAORB; | |
| 7626 | 81 | tempitem.misc1=4; | |
| 7627 | 81 | tempitem.misc2=16; | |
| 7628 | 81 | tempitem.misc3=1; | |
| 7629 | 81 | tempitem.cost_amount[0]=1; | |
| 7630 | 81 | break; | |
| 7631 | |||
| 7632 | case iWhistle: | ||
| 7633 | 81 | tempitem.wpn=wWIND; | |
| 7634 | 81 | tempitem.misc1=3; | |
| 7635 | 81 | tempitem.flags|=item_flag1; | |
| 7636 | 81 | break; | |
| 7637 | |||
| 7638 | case iBRing: | ||
| 7639 | 81 | tempitem.power=2; | |
| 7640 | 81 | tempitem.misc1=spBLUE; | |
| 7641 | 81 | break; | |
| 7642 | |||
| 7643 | case iRRing: | ||
| 7644 | 81 | tempitem.power=4; | |
| 7645 | 81 | tempitem.misc1=spRED; | |
| 7646 | 81 | break; | |
| 7647 | |||
| 7648 | case iGRing: | ||
| 7649 | 81 | tempitem.power=8; | |
| 7650 | 81 | tempitem.misc1=spGOLD; | |
| 7651 | 81 | break; | |
| 7652 | |||
| 7653 | case iSpinScroll: | ||
| 7654 | 81 | tempitem.power = 2; | |
| 7655 | 81 | tempitem.misc1 = 1; | |
| 7656 | 81 | break; | |
| 7657 | |||
| 7658 | case iL2SpinScroll: | ||
| 7659 | 81 | tempitem.type=itype_spinscroll2; | |
| 7660 | 81 | tempitem.level=1; | |
| 7661 | 81 | tempitem.cost_amount[0]=8; | |
| 7662 | 81 | tempitem.power=2; | |
| 7663 | 81 | tempitem.misc1 = 20; | |
| 7664 | 81 | break; | |
| 7665 | |||
| 7666 | case iQuakeScroll: | ||
| 7667 | 81 | tempitem.misc1=0x10; | |
| 7668 | 81 | tempitem.misc2=64; | |
| 7669 | 81 | break; | |
| 7670 | |||
| 7671 | case iL2QuakeScroll: | ||
| 7672 | 81 | tempitem.type=itype_quakescroll2; | |
| 7673 | 81 | tempitem.level=1; | |
| 7674 | 81 | tempitem.power = 2; | |
| 7675 | 81 | tempitem.misc1=0x20; | |
| 7676 | 81 | tempitem.misc2=192; | |
| 7677 | 81 | tempitem.cost_amount[0]=8; | |
| 7678 | 81 | break; | |
| 7679 | |||
| 7680 | case iChargeRing: | ||
| 7681 | 81 | tempitem.misc1=64; | |
| 7682 | 81 | tempitem.misc2=128; | |
| 7683 | 81 | break; | |
| 7684 | |||
| 7685 | case iL2ChargeRing: | ||
| 7686 | 81 | tempitem.misc1=32; | |
| 7687 | 81 | tempitem.misc2=64; | |
| 7688 | 81 | break; | |
| 7689 | |||
| 7690 | case iOldGlove: | ||
| 7691 | 81 | tempitem.flags |= item_flag1; | |
| 7692 | |||
| 7693 | //fallthrough | ||
| 7694 | case iBombBagL4: | ||
| 7695 | case iWalletL3: | ||
| 7696 | case iQuiverL4: | ||
| 7697 | case iBracelet: | ||
| 7698 | 405 | tempitem.power = 1; | |
| 7699 | 405 | break; | |
| 7700 | |||
| 7701 | case iL2Bracelet: | ||
| 7702 | 81 | tempitem.power = 2; | |
| 7703 | 81 | break; | |
| 7704 | |||
| 7705 | case iMKey: | ||
| 7706 | 81 | tempitem.power=0xFF; | |
| 7707 | 81 | tempitem.flags |= item_flag1; | |
| 7708 | 81 | break; | |
| 7709 | } | ||
| 7710 | 20736 | } | |
| 7711 | |||
| 7712 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 20736 times.
|
126976 | if(s_version < 7) |
| 7713 | { | ||
| 7714 |
2/2✓ Branch 0 taken 324 times.
✓ Branch 1 taken 20412 times.
|
20736 | switch(i) |
| 7715 | { | ||
| 7716 | case iStoneAgony: | ||
| 7717 | case iStompBoots: | ||
| 7718 | case iPerilRing: | ||
| 7719 | case iWhimsicalRing: | ||
| 7720 | { | ||
| 7721 | 324 | reset_itembuf(&tempitem, i); | |
| 7722 | 324 | strcpy(item_string[i],old_item_string[i]); | |
| 7723 | 324 | break; | |
| 7724 | } | ||
| 7725 | } | ||
| 7726 | 20736 | } | |
| 7727 | |||
| 7728 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 20736 times.
|
126976 | if(s_version < 8) // May 2007: Some corrections. |
| 7729 | { | ||
| 7730 |
7/7✓ Branch 0 taken 81 times.
✓ Branch 1 taken 243 times.
✓ Branch 2 taken 20088 times.
✓ Branch 3 taken 81 times.
✓ Branch 4 taken 81 times.
✓ Branch 5 taken 81 times.
✓ Branch 6 taken 81 times.
|
20736 | switch(i) |
| 7731 | { | ||
| 7732 | case iMShield: | ||
| 7733 | 81 | tempitem.misc1|=sh_flame; | |
| 7734 | 81 | tempitem.misc2|=sh_fireball|sh_magic; | |
| 7735 | |||
| 7736 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | if(get_qr(qr_SWORDMIRROR)) |
| 7737 | { | ||
| 7738 | ✗ | tempitem.misc2 |= sh_sword; | |
| 7739 | ✗ | } | |
| 7740 | |||
| 7741 | // fallthrough | ||
| 7742 | case iShield: | ||
| 7743 | 162 | tempitem.misc1|=sh_fireball|sh_sword|sh_magic; | |
| 7744 | |||
| 7745 | // fallthrough | ||
| 7746 | case iSShield: | ||
| 7747 | 243 | tempitem.misc1|=sh_rock|sh_arrow|sh_brang|sh_script; | |
| 7748 | |||
| 7749 |
1/2✓ Branch 0 taken 243 times.
✗ Branch 1 not taken.
|
243 | if(get_bit(deprecated_rules,102)) //qr_REFLECTROCKS |
| 7750 | { | ||
| 7751 | ✗ | tempitem.misc2 |= sh_rock; | |
| 7752 | ✗ | } | |
| 7753 | |||
| 7754 | 243 | break; | |
| 7755 | |||
| 7756 | case iWhispRing: | ||
| 7757 | 81 | tempitem.power=1; | |
| 7758 | 81 | tempitem.flags|=item_gamedata|item_flag1; | |
| 7759 | 81 | tempitem.misc1 = 3; | |
| 7760 | 81 | break; | |
| 7761 | |||
| 7762 | case iL2WhispRing: | ||
| 7763 | 81 | tempitem.power=0; | |
| 7764 | 81 | tempitem.flags|=item_gamedata|item_flag1; | |
| 7765 | 81 | tempitem.misc1 = 3; | |
| 7766 | 81 | break; | |
| 7767 | |||
| 7768 | case iL2Ladder: | ||
| 7769 | case iBow: | ||
| 7770 | case iCByrna: | ||
| 7771 | 243 | tempitem.power = 1; | |
| 7772 | 243 | break; | |
| 7773 | } | ||
| 7774 | 20736 | } | |
| 7775 | |||
| 7776 |
4/4✓ Branch 0 taken 20736 times.
✓ Branch 1 taken 106240 times.
✓ Branch 2 taken 20655 times.
✓ Branch 3 taken 81 times.
|
126976 | if(s_version < 9 && i==iClock) |
| 7777 | { | ||
| 7778 | 81 | tempitem.misc1 = get_bit(deprecated_rules, qr_TEMPCLOCKS_DEP) ? 256 : 0; | |
| 7779 | 81 | } | |
| 7780 | |||
| 7781 | //add the misc flag for bomb | ||
| 7782 |
4/4✓ Branch 0 taken 20736 times.
✓ Branch 1 taken 106240 times.
✓ Branch 2 taken 20655 times.
✓ Branch 3 taken 81 times.
|
126976 | if(s_version < 10 && tempitem.type == itype_bomb) |
| 7783 | { | ||
| 7784 | 81 | tempitem.flags = (tempitem.flags & ~item_flag1) | (get_qr(qr_LONGBOMBBOOM_DEP) ? item_flag1 : item_none); | |
| 7785 | 81 | } | |
| 7786 | |||
| 7787 |
4/4✓ Branch 0 taken 20736 times.
✓ Branch 1 taken 106240 times.
✓ Branch 2 taken 20574 times.
✓ Branch 3 taken 162 times.
|
126976 | if(s_version < 11 && tempitem.type == itype_triforcepiece) |
| 7788 | { | ||
| 7789 | 162 | tempitem.flags = (tempitem.level ? item_gamedata : item_none); | |
| 7790 | 162 | tempitem.playsound = (tempitem.level ? WAV_SCALE : WAV_CLEARED); | |
| 7791 | 162 | } | |
| 7792 | |||
| 7793 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 20736 times.
|
126976 | if(s_version < 12) // June 2007: More Misc. attributes. |
| 7794 | { | ||
| 7795 |
5/5✓ Branch 0 taken 162 times.
✓ Branch 1 taken 20331 times.
✓ Branch 2 taken 81 times.
✓ Branch 3 taken 81 times.
✓ Branch 4 taken 81 times.
|
20736 | switch(i) |
| 7796 | { | ||
| 7797 | case iFBrang: | ||
| 7798 | 81 | tempitem.misc4 |= sh_fireball|sh_sword|sh_magic; | |
| 7799 | |||
| 7800 | //fallthrough | ||
| 7801 | case iMBrang: | ||
| 7802 | 162 | tempitem.misc3 |= sh_sword|sh_magic; | |
| 7803 | |||
| 7804 | //fallthrough | ||
| 7805 | case iHookshot: | ||
| 7806 | case iLongshot: | ||
| 7807 | //fallthrough | ||
| 7808 | 324 | tempitem.misc3 |= sh_fireball; | |
| 7809 | |||
| 7810 | case iBrang: | ||
| 7811 | 405 | tempitem.misc3 |= sh_brang|sh_rock|sh_arrow; | |
| 7812 | 405 | break; | |
| 7813 | } | ||
| 7814 | |||
| 7815 |
16/16✓ Branch 0 taken 81 times.
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 81 times.
✓ Branch 3 taken 243 times.
✓ Branch 4 taken 162 times.
✓ Branch 5 taken 243 times.
✓ Branch 6 taken 81 times.
✓ Branch 7 taken 81 times.
✓ Branch 8 taken 81 times.
✓ Branch 9 taken 324 times.
✓ Branch 10 taken 162 times.
✓ Branch 11 taken 9535 times.
✓ Branch 12 taken 243 times.
✓ Branch 13 taken 9176 times.
✓ Branch 14 taken 81 times.
✓ Branch 15 taken 81 times.
|
20736 | switch(tempitem.type) |
| 7816 | { | ||
| 7817 | case itype_hoverboots: | ||
| 7818 | 81 | tempitem.usesound = WAV_ZN1HOVER; | |
| 7819 | 81 | break; | |
| 7820 | |||
| 7821 | case itype_wand: | ||
| 7822 | 81 | tempitem.usesound = WAV_WAND; | |
| 7823 | 81 | break; | |
| 7824 | |||
| 7825 | case itype_book: | ||
| 7826 | 81 | tempitem.usesound = WAV_FIRE; | |
| 7827 | 81 | break; | |
| 7828 | |||
| 7829 | case itype_arrow: | ||
| 7830 | 243 | tempitem.usesound = WAV_ARROW; | |
| 7831 | 243 | break; | |
| 7832 | |||
| 7833 | case itype_hookshot: | ||
| 7834 | 162 | tempitem.usesound = WAV_HOOKSHOT; | |
| 7835 | 162 | break; | |
| 7836 | |||
| 7837 | case itype_brang: | ||
| 7838 | 243 | tempitem.usesound = WAV_BRANG; | |
| 7839 | 243 | break; | |
| 7840 | |||
| 7841 | case itype_shield: | ||
| 7842 | 243 | tempitem.usesound = WAV_CHINK; | |
| 7843 | 243 | break; | |
| 7844 | |||
| 7845 | case itype_sword: | ||
| 7846 | 9176 | tempitem.usesound = WAV_SWORD; | |
| 7847 | 9176 | break; | |
| 7848 | |||
| 7849 | case itype_whistle: | ||
| 7850 | 81 | tempitem.usesound = WAV_WHISTLE; | |
| 7851 | 81 | break; | |
| 7852 | |||
| 7853 | case itype_hammer: | ||
| 7854 | 81 | tempitem.usesound = WAV_HAMMER; | |
| 7855 | 81 | break; | |
| 7856 | |||
| 7857 | case itype_divinefire: | ||
| 7858 | 81 | tempitem.usesound = WAV_ZN1DIVINEFIRE; | |
| 7859 | 81 | break; | |
| 7860 | |||
| 7861 | case itype_divineescape: | ||
| 7862 | 81 | tempitem.usesound = WAV_ZN1DIVINEESCAPE; | |
| 7863 | 81 | break; | |
| 7864 | |||
| 7865 | case itype_divineprotection: | ||
| 7866 | 81 | tempitem.usesound = WAV_ZN1DIVINEPROTECTION1; | |
| 7867 | 81 | break; | |
| 7868 | |||
| 7869 | case itype_bomb: | ||
| 7870 | case itype_sbomb: | ||
| 7871 | case itype_quakescroll: | ||
| 7872 | case itype_quakescroll2: | ||
| 7873 | 324 | tempitem.usesound = WAV_BOMB; | |
| 7874 | 324 | break; | |
| 7875 | |||
| 7876 | case itype_spinscroll: | ||
| 7877 | case itype_spinscroll2: | ||
| 7878 | 162 | tempitem.usesound = WAV_ZN1SPINATTACK; | |
| 7879 | 162 | break; | |
| 7880 | } | ||
| 7881 | 20736 | } | |
| 7882 | |||
| 7883 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 20736 times.
|
126976 | if(s_version < 13) // July 2007 |
| 7884 | { | ||
| 7885 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 20655 times.
|
20736 | if(tempitem.type == itype_whistle) |
| 7886 | { | ||
| 7887 | 81 | tempitem.misc1 = (tempitem.power==2 ? 4 : 3); | |
| 7888 | 81 | tempitem.power = 1; | |
| 7889 | 81 | tempitem.flags|=item_flag1; | |
| 7890 | 81 | } | |
| 7891 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 20574 times.
|
20655 | else if(tempitem.type == itype_wand) |
| 7892 | 81 | tempitem.flags|=item_flag1; | |
| 7893 |
2/2✓ Branch 0 taken 20493 times.
✓ Branch 1 taken 81 times.
|
20574 | else if(tempitem.type == itype_book) |
| 7894 | { | ||
| 7895 | 81 | tempitem.flags|=item_flag1; | |
| 7896 | 81 | tempitem.power = 2; | |
| 7897 | 81 | } | |
| 7898 | 20736 | } | |
| 7899 | |||
| 7900 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 20736 times.
|
126976 | if(s_version < 14) // August 2007 |
| 7901 | { | ||
| 7902 |
2/2✓ Branch 0 taken 162 times.
✓ Branch 1 taken 20574 times.
|
20736 | if(tempitem.type == itype_fairy) |
| 7903 | { | ||
| 7904 | 162 | tempitem.usesound = WAV_SCALE; | |
| 7905 | |||
| 7906 |
1/2✓ Branch 0 taken 162 times.
✗ Branch 1 not taken.
|
162 | if(tempitem.level) |
| 7907 | 162 | tempitem.misc3=50; | |
| 7908 | 162 | } | |
| 7909 |
2/2✓ Branch 0 taken 20412 times.
✓ Branch 1 taken 162 times.
|
20574 | else if(tempitem.type == itype_potion) |
| 7910 | { | ||
| 7911 | 162 | tempitem.flags |= item_gain_old; | |
| 7912 | 162 | } | |
| 7913 | 20736 | } | |
| 7914 | |||
| 7915 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 20736 times.
|
126976 | if(s_version < 17) // November 2007 |
| 7916 | { | ||
| 7917 |
3/4✓ Branch 0 taken 162 times.
✓ Branch 1 taken 20574 times.
✓ Branch 2 taken 162 times.
✗ Branch 3 not taken.
|
20736 | if(tempitem.type == itype_candle && !tempitem.wpn3) |
| 7918 | { | ||
| 7919 | ✗ | tempitem.wpn3 = wFIRE; | |
| 7920 | ✗ | } | |
| 7921 |
4/4✓ Branch 0 taken 243 times.
✓ Branch 1 taken 20493 times.
✓ Branch 2 taken 162 times.
✓ Branch 3 taken 81 times.
|
20736 | else if(tempitem.type == itype_arrow && tempitem.power>4) |
| 7922 | { | ||
| 7923 | 81 | tempitem.flags|=item_flag1; | |
| 7924 | 81 | } | |
| 7925 | 20736 | } | |
| 7926 | |||
| 7927 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 20736 times.
|
126976 | if(s_version < 18) // New Year's Eve 2007 |
| 7928 | { | ||
| 7929 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 20655 times.
|
20736 | if(tempitem.type == itype_whistle) |
| 7930 | 81 | tempitem.misc2 = 8; // Use the Whistle warp ring | |
| 7931 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 20574 times.
|
20655 | else if(tempitem.type == itype_bait) |
| 7932 | 81 | tempitem.misc1 = 768; // Frames until it goes | |
| 7933 |
2/2✓ Branch 0 taken 20412 times.
✓ Branch 1 taken 162 times.
|
20574 | else if(tempitem.type == itype_triforcepiece) |
| 7934 | { | ||
| 7935 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 81 times.
|
162 | if(tempitem.flags & item_gamedata) |
| 7936 | { | ||
| 7937 | 81 | tempitem.misc2 = 1; // Cutscene 1 | |
| 7938 | 81 | tempitem.flags |= item_flag1; // Side Warp Out | |
| 7939 | 81 | } | |
| 7940 | 162 | } | |
| 7941 | 20736 | } | |
| 7942 | |||
| 7943 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 20736 times.
|
126976 | if(s_version < 19) // January 2008 |
| 7944 | { | ||
| 7945 |
2/2✓ Branch 0 taken 20655 times.
✓ Branch 1 taken 81 times.
|
20736 | if(tempitem.type == itype_divineprotection) |
| 7946 | { | ||
| 7947 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 79 times.
|
81 | if (get_bit(deprecated_rules,qr_NOBOMBPALFLASH+1)) tempitem.flags |= item_flag3; |
| 7948 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 72 times.
|
81 | if (get_bit(deprecated_rules,qr_NOBOMBPALFLASH+2)) tempitem.flags |= item_flag4; |
| 7949 | 81 | } | |
| 7950 | 20736 | } | |
| 7951 | |||
| 7952 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 20736 times.
|
126976 | if(s_version < 20) // October 2008 |
| 7953 | { | ||
| 7954 |
2/2✓ Branch 0 taken 20655 times.
✓ Branch 1 taken 81 times.
|
20736 | if(tempitem.type == itype_divineprotection) |
| 7955 | { | ||
| 7956 | 81 | tempitem.wpn6=wDIVINEPROTECTION2A; | |
| 7957 | 81 | tempitem.wpn7=wDIVINEPROTECTION2B; | |
| 7958 | 81 | tempitem.wpn8=wDIVINEPROTECTIONS2A; | |
| 7959 | 81 | tempitem.wpn9=wDIVINEPROTECTIONS2B; | |
| 7960 | 81 | tempitem.wpn5 = iwDivineProtectionShieldFront; | |
| 7961 | 81 | tempitem.wpn10 = iwDivineProtectionShieldBack; | |
| 7962 | 81 | } | |
| 7963 | 20736 | } | |
| 7964 | |||
| 7965 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 20736 times.
|
126976 | if(s_version < 21) // November 2008 |
| 7966 | { | ||
| 7967 |
1/2✓ Branch 0 taken 20736 times.
✗ Branch 1 not taken.
|
20736 | if(tempitem.flags & 0x0100) // item_slash |
| 7968 | { | ||
| 7969 | ✗ | tempitem.flags &= ~item_unused; | |
| 7970 | |||
| 7971 | ✗ | if(tempitem.type == itype_sword || | |
| 7972 | ✗ | tempitem.type == itype_wand || | |
| 7973 | ✗ | tempitem.type == itype_candle || | |
| 7974 | ✗ | tempitem.type == itype_cbyrna) | |
| 7975 | { | ||
| 7976 | ✗ | tempitem.flags |= item_flag4; | |
| 7977 | ✗ | } | |
| 7978 | ✗ | } | |
| 7979 | 20736 | } | |
| 7980 | |||
| 7981 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 20736 times.
|
126976 | if(s_version < 22) // September 2009 |
| 7982 | { | ||
| 7983 |
4/4✓ Branch 0 taken 20655 times.
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 81 times.
✓ Branch 3 taken 20574 times.
|
20736 | if(tempitem.type == itype_sbomb || tempitem.type == itype_bomb) |
| 7984 | { | ||
| 7985 | 162 | tempitem.misc3 = tempitem.power/2; | |
| 7986 | 162 | } | |
| 7987 | 20736 | } | |
| 7988 | |||
| 7989 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 20736 times.
|
126976 | if(s_version < 23) // March 2011 |
| 7990 | { | ||
| 7991 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 20655 times.
|
20736 | if(tempitem.type == itype_divinefire) |
| 7992 | 81 | tempitem.wpn5 = wFIRE; | |
| 7993 |
2/2✓ Branch 0 taken 20574 times.
✓ Branch 1 taken 81 times.
|
20655 | else if(tempitem.type == itype_book) |
| 7994 | 81 | tempitem.wpn2 = wFIRE; | |
| 7995 | 20736 | } | |
| 7996 | |||
| 7997 | // Version 25: Bomb bags were acting as though "super bombs also" was checked | ||
| 7998 | // whether it was or not, and a lot of existing quests depended on the | ||
| 7999 | // incorrect behavior. | ||
| 8000 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 20736 times.
|
126976 | if(s_version < 25) // January 2012 |
| 8001 | { | ||
| 8002 |
2/2✓ Branch 0 taken 20412 times.
✓ Branch 1 taken 324 times.
|
20736 | if(tempitem.type == itype_bombbag) |
| 8003 | 324 | tempitem.flags |= item_flag1; | |
| 8004 | |||
| 8005 |
2/2✓ Branch 0 taken 20655 times.
✓ Branch 1 taken 81 times.
|
20736 | if(tempitem.type == itype_divinefire) |
| 8006 | 81 | tempitem.flags |= item_flag3; // Sideview gravity flag | |
| 8007 | 20736 | } | |
| 8008 | |||
| 8009 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 71936 times.
|
126976 | if( version < 0x254) //Nuke greyed-out flags/values from <=2.53, in case they are used in 2.54/2.55 |
| 8010 | { | ||
| 8011 |
60/60✓ Branch 0 taken 17410 times.
✓ Branch 1 taken 841 times.
✓ Branch 2 taken 828 times.
✓ Branch 3 taken 598 times.
✓ Branch 4 taken 326 times.
✓ Branch 5 taken 281 times.
✓ Branch 6 taken 556 times.
✓ Branch 7 taken 612 times.
✓ Branch 8 taken 296 times.
✓ Branch 9 taken 914 times.
✓ Branch 10 taken 889 times.
✓ Branch 11 taken 555 times.
✓ Branch 12 taken 855 times.
✓ Branch 13 taken 556 times.
✓ Branch 14 taken 278 times.
✓ Branch 15 taken 556 times.
✓ Branch 16 taken 294 times.
✓ Branch 17 taken 278 times.
✓ Branch 18 taken 843 times.
✓ Branch 19 taken 281 times.
✓ Branch 20 taken 284 times.
✓ Branch 21 taken 558 times.
✓ Branch 22 taken 254 times.
✓ Branch 23 taken 281 times.
✓ Branch 24 taken 278 times.
✓ Branch 25 taken 278 times.
✓ Branch 26 taken 278 times.
✓ Branch 27 taken 294 times.
✓ Branch 28 taken 280 times.
✓ Branch 29 taken 281 times.
✓ Branch 30 taken 278 times.
✓ Branch 31 taken 283 times.
✓ Branch 32 taken 556 times.
✓ Branch 33 taken 1112 times.
✓ Branch 34 taken 779 times.
✓ Branch 35 taken 278 times.
✓ Branch 36 taken 543 times.
✓ Branch 37 taken 1112 times.
✓ Branch 38 taken 278 times.
✓ Branch 39 taken 278 times.
✓ Branch 40 taken 278 times.
✓ Branch 41 taken 278 times.
✓ Branch 42 taken 278 times.
✓ Branch 43 taken 559 times.
✓ Branch 44 taken 556 times.
✓ Branch 45 taken 278 times.
✓ Branch 46 taken 837 times.
✓ Branch 47 taken 840 times.
✓ Branch 48 taken 1124 times.
✓ Branch 49 taken 278 times.
✓ Branch 50 taken 278 times.
✓ Branch 51 taken 278 times.
✓ Branch 52 taken 278 times.
✓ Branch 53 taken 278 times.
✓ Branch 54 taken 305 times.
✓ Branch 55 taken 10647 times.
✓ Branch 56 taken 2862 times.
✓ Branch 57 taken 839 times.
✓ Branch 58 taken 3250 times.
✓ Branch 59 taken 11005 times.
|
71936 | switch(tempitem.type) |
| 8012 | { | ||
| 8013 | case itype_sword: | ||
| 8014 | { | ||
| 8015 | 17410 | tempitem.flags &= ~(item_flag5); | |
| 8016 | 17410 | tempitem.misc3 = 0; | |
| 8017 | 17410 | tempitem.misc4 = 0; | |
| 8018 | 17410 | tempitem.misc5 = 0; | |
| 8019 | 17410 | tempitem.misc6 = 0; | |
| 8020 | 17410 | tempitem.misc7 = 0; | |
| 8021 | 17410 | tempitem.misc8 = 0; | |
| 8022 | 17410 | tempitem.misc9 = 0; | |
| 8023 | 17410 | tempitem.misc10 = 0; | |
| 8024 | 17410 | tempitem.wpn4 = 0; | |
| 8025 | 17410 | tempitem.wpn5 = 0; | |
| 8026 | 17410 | tempitem.wpn6 = 0; | |
| 8027 | 17410 | tempitem.wpn7 = 0; | |
| 8028 | 17410 | tempitem.wpn8 = 0; | |
| 8029 | 17410 | tempitem.wpn9 = 0; | |
| 8030 | 17410 | tempitem.wpn10 = 0; | |
| 8031 | 17410 | break; | |
| 8032 | } | ||
| 8033 | case itype_brang: | ||
| 8034 | { | ||
| 8035 | 841 | tempitem.flags &= ~(item_flag4 | item_flag5); | |
| 8036 | 841 | tempitem.misc2 = 0; | |
| 8037 | 841 | tempitem.misc5 = 0; | |
| 8038 | 841 | tempitem.misc6 = 0; | |
| 8039 | 841 | tempitem.misc7 = 0; | |
| 8040 | 841 | tempitem.misc8 = 0; | |
| 8041 | 841 | tempitem.misc9 = 0; | |
| 8042 | 841 | tempitem.misc10 = 0; | |
| 8043 | 841 | tempitem.wpn4 = 0; | |
| 8044 | 841 | tempitem.wpn5 = 0; | |
| 8045 | 841 | tempitem.wpn6 = 0; | |
| 8046 | 841 | tempitem.wpn7 = 0; | |
| 8047 | 841 | tempitem.wpn8 = 0; | |
| 8048 | 841 | tempitem.wpn9 = 0; | |
| 8049 | 841 | tempitem.wpn10 = 0; | |
| 8050 | 841 | break; | |
| 8051 | } | ||
| 8052 | case itype_arrow: | ||
| 8053 | { | ||
| 8054 | 828 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8055 | 828 | tempitem.misc2 = 0; | |
| 8056 | 828 | tempitem.misc3 = 0; | |
| 8057 | 828 | tempitem.misc4 = 0; | |
| 8058 | 828 | tempitem.misc5 = 0; | |
| 8059 | 828 | tempitem.misc6 = 0; | |
| 8060 | 828 | tempitem.misc7 = 0; | |
| 8061 | 828 | tempitem.misc8 = 0; | |
| 8062 | 828 | tempitem.misc9 = 0; | |
| 8063 | 828 | tempitem.misc10 = 0; | |
| 8064 | 828 | tempitem.wpn4 = 0; | |
| 8065 | 828 | tempitem.wpn5 = 0; | |
| 8066 | 828 | tempitem.wpn6 = 0; | |
| 8067 | 828 | tempitem.wpn7 = 0; | |
| 8068 | 828 | tempitem.wpn8 = 0; | |
| 8069 | 828 | tempitem.wpn9 = 0; | |
| 8070 | 828 | tempitem.wpn10 = 0; | |
| 8071 | 828 | break; | |
| 8072 | } | ||
| 8073 | case itype_candle: | ||
| 8074 | { | ||
| 8075 | 598 | tempitem.flags &= ~ (item_flag3 | item_flag5); | |
| 8076 | 598 | tempitem.misc1 = 0; | |
| 8077 | 598 | tempitem.misc2 = 0; | |
| 8078 | 598 | tempitem.misc3 = 0; | |
| 8079 | 598 | tempitem.misc4 = 0; | |
| 8080 | 598 | tempitem.misc5 = 0; | |
| 8081 | 598 | tempitem.misc6 = 0; | |
| 8082 | 598 | tempitem.misc7 = 0; | |
| 8083 | 598 | tempitem.misc8 = 0; | |
| 8084 | 598 | tempitem.misc9 = 0; | |
| 8085 | 598 | tempitem.misc10 = 0; | |
| 8086 | 598 | tempitem.wpn4 = 0; | |
| 8087 | 598 | tempitem.wpn5 = 0; | |
| 8088 | 598 | tempitem.wpn6 = 0; | |
| 8089 | 598 | tempitem.wpn7 = 0; | |
| 8090 | 598 | tempitem.wpn8 = 0; | |
| 8091 | 598 | tempitem.wpn9 = 0; | |
| 8092 | 598 | tempitem.wpn10 = 0; | |
| 8093 | 598 | break; | |
| 8094 | } | ||
| 8095 | case itype_whistle: | ||
| 8096 | { | ||
| 8097 | 326 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8098 | 326 | tempitem.misc3 = 0; | |
| 8099 | 326 | tempitem.misc4 = 0; | |
| 8100 | 326 | tempitem.misc5 = 0; | |
| 8101 | 326 | tempitem.misc6 = 0; | |
| 8102 | 326 | tempitem.misc7 = 0; | |
| 8103 | 326 | tempitem.misc8 = 0; | |
| 8104 | 326 | tempitem.misc9 = 0; | |
| 8105 | 326 | tempitem.misc10 = 0; | |
| 8106 | 326 | tempitem.wpn2 = 0; | |
| 8107 | 326 | tempitem.wpn3 = 0; | |
| 8108 | 326 | tempitem.wpn4 = 0; | |
| 8109 | 326 | tempitem.wpn5 = 0; | |
| 8110 | 326 | tempitem.wpn6 = 0; | |
| 8111 | 326 | tempitem.wpn7 = 0; | |
| 8112 | 326 | tempitem.wpn8 = 0; | |
| 8113 | 326 | tempitem.wpn9 = 0; | |
| 8114 | 326 | tempitem.wpn10 = 0; | |
| 8115 | 326 | break; | |
| 8116 | } | ||
| 8117 | case itype_bait: | ||
| 8118 | { | ||
| 8119 | 281 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8120 | 281 | tempitem.misc2 = 0; | |
| 8121 | 281 | tempitem.misc3 = 0; | |
| 8122 | 281 | tempitem.misc4 = 0; | |
| 8123 | 281 | tempitem.misc5 = 0; | |
| 8124 | 281 | tempitem.misc6 = 0; | |
| 8125 | 281 | tempitem.misc7 = 0; | |
| 8126 | 281 | tempitem.misc8 = 0; | |
| 8127 | 281 | tempitem.misc9 = 0; | |
| 8128 | 281 | tempitem.misc10 = 0; | |
| 8129 | 281 | tempitem.wpn2 = 0; | |
| 8130 | 281 | tempitem.wpn3 = 0; | |
| 8131 | 281 | tempitem.wpn4 = 0; | |
| 8132 | 281 | tempitem.wpn5 = 0; | |
| 8133 | 281 | tempitem.wpn6 = 0; | |
| 8134 | 281 | tempitem.wpn7 = 0; | |
| 8135 | 281 | tempitem.wpn8 = 0; | |
| 8136 | 281 | tempitem.wpn9 = 0; | |
| 8137 | 281 | tempitem.wpn10 = 0; | |
| 8138 | 281 | break; | |
| 8139 | } | ||
| 8140 | case itype_letter: | ||
| 8141 | { | ||
| 8142 | 556 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8143 | 556 | tempitem.misc1 = 0; | |
| 8144 | 556 | tempitem.misc2 = 0; | |
| 8145 | 556 | tempitem.misc3 = 0; | |
| 8146 | 556 | tempitem.misc4 = 0; | |
| 8147 | 556 | tempitem.misc5 = 0; | |
| 8148 | 556 | tempitem.misc6 = 0; | |
| 8149 | 556 | tempitem.misc7 = 0; | |
| 8150 | 556 | tempitem.misc8 = 0; | |
| 8151 | 556 | tempitem.misc9 = 0; | |
| 8152 | 556 | tempitem.misc10 = 0; | |
| 8153 | 556 | tempitem.wpn = 0; | |
| 8154 | 556 | tempitem.wpn2 = 0; | |
| 8155 | 556 | tempitem.wpn3 = 0; | |
| 8156 | 556 | tempitem.wpn4 = 0; | |
| 8157 | 556 | tempitem.wpn5 = 0; | |
| 8158 | 556 | tempitem.wpn6 = 0; | |
| 8159 | 556 | tempitem.wpn7 = 0; | |
| 8160 | 556 | tempitem.wpn8 = 0; | |
| 8161 | 556 | tempitem.wpn9 = 0; | |
| 8162 | 556 | tempitem.wpn10 = 0; | |
| 8163 | 556 | break; | |
| 8164 | } | ||
| 8165 | case itype_potion: | ||
| 8166 | { | ||
| 8167 | 612 | tempitem.flags &= ~ (item_flag3 | item_flag4 | item_flag5); | |
| 8168 | 612 | tempitem.misc3 = 0; | |
| 8169 | 612 | tempitem.misc4 = 0; | |
| 8170 | 612 | tempitem.misc5 = 0; | |
| 8171 | 612 | tempitem.misc6 = 0; | |
| 8172 | 612 | tempitem.misc7 = 0; | |
| 8173 | 612 | tempitem.misc8 = 0; | |
| 8174 | 612 | tempitem.misc9 = 0; | |
| 8175 | 612 | tempitem.misc10 = 0; | |
| 8176 | 612 | tempitem.wpn = 0; | |
| 8177 | 612 | tempitem.wpn2 = 0; | |
| 8178 | 612 | tempitem.wpn3 = 0; | |
| 8179 | 612 | tempitem.wpn4 = 0; | |
| 8180 | 612 | tempitem.wpn5 = 0; | |
| 8181 | 612 | tempitem.wpn6 = 0; | |
| 8182 | 612 | tempitem.wpn7 = 0; | |
| 8183 | 612 | tempitem.wpn8 = 0; | |
| 8184 | 612 | tempitem.wpn9 = 0; | |
| 8185 | 612 | tempitem.wpn10 = 0; | |
| 8186 | 612 | break; | |
| 8187 | } | ||
| 8188 | case itype_wand: | ||
| 8189 | { | ||
| 8190 | 296 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag5); | |
| 8191 | 296 | tempitem.misc1 = 0; | |
| 8192 | 296 | tempitem.misc2 = 0; | |
| 8193 | 296 | tempitem.misc3 = 0; | |
| 8194 | 296 | tempitem.misc4 = 0; | |
| 8195 | 296 | tempitem.misc5 = 0; | |
| 8196 | 296 | tempitem.misc6 = 0; | |
| 8197 | 296 | tempitem.misc7 = 0; | |
| 8198 | 296 | tempitem.misc8 = 0; | |
| 8199 | 296 | tempitem.misc9 = 0; | |
| 8200 | 296 | tempitem.misc10 = 0; | |
| 8201 | 296 | tempitem.wpn4 = 0; | |
| 8202 | 296 | tempitem.wpn5 = 0; | |
| 8203 | 296 | tempitem.wpn6 = 0; | |
| 8204 | 296 | tempitem.wpn7 = 0; | |
| 8205 | 296 | tempitem.wpn8 = 0; | |
| 8206 | 296 | tempitem.wpn9 = 0; | |
| 8207 | 296 | tempitem.wpn10 = 0; | |
| 8208 | 296 | break; | |
| 8209 | } | ||
| 8210 | case itype_ring: | ||
| 8211 | { | ||
| 8212 | 914 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8213 | 914 | tempitem.misc2 = 0; | |
| 8214 | 914 | tempitem.misc3 = 0; | |
| 8215 | 914 | tempitem.misc4 = 0; | |
| 8216 | 914 | tempitem.misc5 = 0; | |
| 8217 | 914 | tempitem.misc6 = 0; | |
| 8218 | 914 | tempitem.misc7 = 0; | |
| 8219 | 914 | tempitem.misc8 = 0; | |
| 8220 | 914 | tempitem.misc9 = 0; | |
| 8221 | 914 | tempitem.misc10 = 0; | |
| 8222 | 914 | tempitem.wpn = 0; | |
| 8223 | 914 | tempitem.wpn2 = 0; | |
| 8224 | 914 | tempitem.wpn3 = 0; | |
| 8225 | 914 | tempitem.wpn4 = 0; | |
| 8226 | 914 | tempitem.wpn5 = 0; | |
| 8227 | 914 | tempitem.wpn6 = 0; | |
| 8228 | 914 | tempitem.wpn7 = 0; | |
| 8229 | 914 | tempitem.wpn8 = 0; | |
| 8230 | 914 | tempitem.wpn9 = 0; | |
| 8231 | 914 | tempitem.wpn10 = 0; | |
| 8232 | 914 | break; | |
| 8233 | } | ||
| 8234 | case itype_wallet: | ||
| 8235 | { | ||
| 8236 | 889 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8237 | 889 | tempitem.misc3 = 0; | |
| 8238 | 889 | tempitem.misc4 = 0; | |
| 8239 | 889 | tempitem.misc5 = 0; | |
| 8240 | 889 | tempitem.misc6 = 0; | |
| 8241 | 889 | tempitem.misc7 = 0; | |
| 8242 | 889 | tempitem.misc8 = 0; | |
| 8243 | 889 | tempitem.misc9 = 0; | |
| 8244 | 889 | tempitem.misc10 = 0; | |
| 8245 | 889 | tempitem.wpn = 0; | |
| 8246 | 889 | tempitem.wpn2 = 0; | |
| 8247 | 889 | tempitem.wpn3 = 0; | |
| 8248 | 889 | tempitem.wpn4 = 0; | |
| 8249 | 889 | tempitem.wpn5 = 0; | |
| 8250 | 889 | tempitem.wpn6 = 0; | |
| 8251 | 889 | tempitem.wpn7 = 0; | |
| 8252 | 889 | tempitem.wpn8 = 0; | |
| 8253 | 889 | tempitem.wpn9 = 0; | |
| 8254 | 889 | tempitem.wpn10 = 0; | |
| 8255 | 889 | break; | |
| 8256 | } | ||
| 8257 | case itype_amulet: | ||
| 8258 | { | ||
| 8259 | 555 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8260 | 555 | tempitem.misc1 = 0; | |
| 8261 | 555 | tempitem.misc2 = 0; | |
| 8262 | 555 | tempitem.misc3 = 0; | |
| 8263 | 555 | tempitem.misc4 = 0; | |
| 8264 | 555 | tempitem.misc5 = 0; | |
| 8265 | 555 | tempitem.misc6 = 0; | |
| 8266 | 555 | tempitem.misc7 = 0; | |
| 8267 | 555 | tempitem.misc8 = 0; | |
| 8268 | 555 | tempitem.misc9 = 0; | |
| 8269 | 555 | tempitem.misc10 = 0; | |
| 8270 | 555 | tempitem.wpn = 0; | |
| 8271 | 555 | tempitem.wpn2 = 0; | |
| 8272 | 555 | tempitem.wpn3 = 0; | |
| 8273 | 555 | tempitem.wpn4 = 0; | |
| 8274 | 555 | tempitem.wpn5 = 0; | |
| 8275 | 555 | tempitem.wpn6 = 0; | |
| 8276 | 555 | tempitem.wpn7 = 0; | |
| 8277 | 555 | tempitem.wpn8 = 0; | |
| 8278 | 555 | tempitem.wpn9 = 0; | |
| 8279 | 555 | tempitem.wpn10 = 0; | |
| 8280 | 555 | break; | |
| 8281 | } | ||
| 8282 | case itype_shield: | ||
| 8283 | { | ||
| 8284 | 855 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8285 | 855 | tempitem.misc3 = 0; | |
| 8286 | 855 | tempitem.misc4 = 0; | |
| 8287 | 855 | tempitem.misc5 = 0; | |
| 8288 | 855 | tempitem.misc6 = 0; | |
| 8289 | 855 | tempitem.misc7 = 0; | |
| 8290 | 855 | tempitem.misc8 = 0; | |
| 8291 | 855 | tempitem.misc9 = 0; | |
| 8292 | 855 | tempitem.misc10 = 0; | |
| 8293 | 855 | tempitem.wpn = 0; | |
| 8294 | 855 | tempitem.wpn2 = 0; | |
| 8295 | 855 | tempitem.wpn3 = 0; | |
| 8296 | 855 | tempitem.wpn4 = 0; | |
| 8297 | 855 | tempitem.wpn5 = 0; | |
| 8298 | 855 | tempitem.wpn6 = 0; | |
| 8299 | 855 | tempitem.wpn7 = 0; | |
| 8300 | 855 | tempitem.wpn8 = 0; | |
| 8301 | 855 | tempitem.wpn9 = 0; | |
| 8302 | 855 | tempitem.wpn10 = 0; | |
| 8303 | 855 | break; | |
| 8304 | } | ||
| 8305 | case itype_bow: | ||
| 8306 | { | ||
| 8307 | 556 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8308 | 556 | tempitem.misc1 = 0; | |
| 8309 | 556 | tempitem.misc2 = 0; | |
| 8310 | 556 | tempitem.misc3 = 0; | |
| 8311 | 556 | tempitem.misc4 = 0; | |
| 8312 | 556 | tempitem.misc5 = 0; | |
| 8313 | 556 | tempitem.misc6 = 0; | |
| 8314 | 556 | tempitem.misc7 = 0; | |
| 8315 | 556 | tempitem.misc8 = 0; | |
| 8316 | 556 | tempitem.misc9 = 0; | |
| 8317 | 556 | tempitem.misc10 = 0; | |
| 8318 | 556 | tempitem.wpn = 0; | |
| 8319 | 556 | tempitem.wpn2 = 0; | |
| 8320 | 556 | tempitem.wpn3 = 0; | |
| 8321 | 556 | tempitem.wpn4 = 0; | |
| 8322 | 556 | tempitem.wpn5 = 0; | |
| 8323 | 556 | tempitem.wpn6 = 0; | |
| 8324 | 556 | tempitem.wpn7 = 0; | |
| 8325 | 556 | tempitem.wpn8 = 0; | |
| 8326 | 556 | tempitem.wpn9 = 0; | |
| 8327 | 556 | tempitem.wpn10 = 0; | |
| 8328 | 556 | break; | |
| 8329 | } | ||
| 8330 | case itype_raft: | ||
| 8331 | { | ||
| 8332 | 278 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8333 | 278 | tempitem.misc1 = 0; | |
| 8334 | 278 | tempitem.misc2 = 0; | |
| 8335 | 278 | tempitem.misc3 = 0; | |
| 8336 | 278 | tempitem.misc4 = 0; | |
| 8337 | 278 | tempitem.misc5 = 0; | |
| 8338 | 278 | tempitem.misc6 = 0; | |
| 8339 | 278 | tempitem.misc7 = 0; | |
| 8340 | 278 | tempitem.misc8 = 0; | |
| 8341 | 278 | tempitem.misc9 = 0; | |
| 8342 | 278 | tempitem.misc10 = 0; | |
| 8343 | 278 | tempitem.wpn = 0; | |
| 8344 | 278 | tempitem.wpn2 = 0; | |
| 8345 | 278 | tempitem.wpn3 = 0; | |
| 8346 | 278 | tempitem.wpn4 = 0; | |
| 8347 | 278 | tempitem.wpn5 = 0; | |
| 8348 | 278 | tempitem.wpn6 = 0; | |
| 8349 | 278 | tempitem.wpn7 = 0; | |
| 8350 | 278 | tempitem.wpn8 = 0; | |
| 8351 | 278 | tempitem.wpn9 = 0; | |
| 8352 | 278 | tempitem.wpn10 = 0; | |
| 8353 | 278 | break; | |
| 8354 | } | ||
| 8355 | case itype_ladder: | ||
| 8356 | { | ||
| 8357 | 556 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8358 | 556 | tempitem.misc1 = 0; | |
| 8359 | 556 | tempitem.misc2 = 0; | |
| 8360 | 556 | tempitem.misc3 = 0; | |
| 8361 | 556 | tempitem.misc4 = 0; | |
| 8362 | 556 | tempitem.misc5 = 0; | |
| 8363 | 556 | tempitem.misc6 = 0; | |
| 8364 | 556 | tempitem.misc7 = 0; | |
| 8365 | 556 | tempitem.misc8 = 0; | |
| 8366 | 556 | tempitem.misc9 = 0; | |
| 8367 | 556 | tempitem.misc10 = 0; | |
| 8368 | 556 | tempitem.wpn = 0; | |
| 8369 | 556 | tempitem.wpn2 = 0; | |
| 8370 | 556 | tempitem.wpn3 = 0; | |
| 8371 | 556 | tempitem.wpn4 = 0; | |
| 8372 | 556 | tempitem.wpn5 = 0; | |
| 8373 | 556 | tempitem.wpn6 = 0; | |
| 8374 | 556 | tempitem.wpn7 = 0; | |
| 8375 | 556 | tempitem.wpn8 = 0; | |
| 8376 | 556 | tempitem.wpn9 = 0; | |
| 8377 | 556 | tempitem.wpn10 = 0; | |
| 8378 | 556 | break; | |
| 8379 | } | ||
| 8380 | case itype_book: | ||
| 8381 | { | ||
| 8382 | 294 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8383 | 294 | tempitem.misc1 = 0; | |
| 8384 | 294 | tempitem.misc2 = 0; | |
| 8385 | 294 | tempitem.misc3 = 0; | |
| 8386 | 294 | tempitem.misc4 = 0; | |
| 8387 | 294 | tempitem.misc5 = 0; | |
| 8388 | 294 | tempitem.misc6 = 0; | |
| 8389 | 294 | tempitem.misc7 = 0; | |
| 8390 | 294 | tempitem.misc8 = 0; | |
| 8391 | 294 | tempitem.misc9 = 0; | |
| 8392 | 294 | tempitem.misc10 = 0; | |
| 8393 | 294 | tempitem.wpn3 = 0; | |
| 8394 | 294 | tempitem.wpn4 = 0; | |
| 8395 | 294 | tempitem.wpn5 = 0; | |
| 8396 | 294 | tempitem.wpn6 = 0; | |
| 8397 | 294 | tempitem.wpn7 = 0; | |
| 8398 | 294 | tempitem.wpn8 = 0; | |
| 8399 | 294 | tempitem.wpn9 = 0; | |
| 8400 | 294 | tempitem.wpn10 = 0; | |
| 8401 | 294 | break; | |
| 8402 | } | ||
| 8403 | case itype_magickey: | ||
| 8404 | { | ||
| 8405 | 278 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8406 | 278 | tempitem.misc1 = 0; | |
| 8407 | 278 | tempitem.misc2 = 0; | |
| 8408 | 278 | tempitem.misc3 = 0; | |
| 8409 | 278 | tempitem.misc4 = 0; | |
| 8410 | 278 | tempitem.misc5 = 0; | |
| 8411 | 278 | tempitem.misc6 = 0; | |
| 8412 | 278 | tempitem.misc7 = 0; | |
| 8413 | 278 | tempitem.misc8 = 0; | |
| 8414 | 278 | tempitem.misc9 = 0; | |
| 8415 | 278 | tempitem.misc10 = 0; | |
| 8416 | 278 | tempitem.wpn = 0; | |
| 8417 | 278 | tempitem.wpn2 = 0; | |
| 8418 | 278 | tempitem.wpn3 = 0; | |
| 8419 | 278 | tempitem.wpn4 = 0; | |
| 8420 | 278 | tempitem.wpn5 = 0; | |
| 8421 | 278 | tempitem.wpn6 = 0; | |
| 8422 | 278 | tempitem.wpn7 = 0; | |
| 8423 | 278 | tempitem.wpn8 = 0; | |
| 8424 | 278 | tempitem.wpn9 = 0; | |
| 8425 | 278 | tempitem.wpn10 = 0; | |
| 8426 | 278 | break; | |
| 8427 | } | ||
| 8428 | case itype_bracelet: | ||
| 8429 | { | ||
| 8430 | 843 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8431 | 843 | tempitem.misc1 = 0; | |
| 8432 | 843 | tempitem.misc2 = 0; | |
| 8433 | 843 | tempitem.misc3 = 0; | |
| 8434 | 843 | tempitem.misc4 = 0; | |
| 8435 | 843 | tempitem.misc5 = 0; | |
| 8436 | 843 | tempitem.misc6 = 0; | |
| 8437 | 843 | tempitem.misc7 = 0; | |
| 8438 | 843 | tempitem.misc8 = 0; | |
| 8439 | 843 | tempitem.misc9 = 0; | |
| 8440 | 843 | tempitem.misc10 = 0; | |
| 8441 | 843 | tempitem.wpn = 0; | |
| 8442 | 843 | tempitem.wpn2 = 0; | |
| 8443 | 843 | tempitem.wpn3 = 0; | |
| 8444 | 843 | tempitem.wpn4 = 0; | |
| 8445 | 843 | tempitem.wpn5 = 0; | |
| 8446 | 843 | tempitem.wpn6 = 0; | |
| 8447 | 843 | tempitem.wpn7 = 0; | |
| 8448 | 843 | tempitem.wpn8 = 0; | |
| 8449 | 843 | tempitem.wpn9 = 0; | |
| 8450 | 843 | tempitem.wpn10 = 0; | |
| 8451 | 843 | break; | |
| 8452 | } | ||
| 8453 | case itype_flippers: | ||
| 8454 | { | ||
| 8455 | 281 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8456 | 281 | tempitem.misc1 = 0; | |
| 8457 | 281 | tempitem.misc2 = 0; | |
| 8458 | 281 | tempitem.misc3 = 0; | |
| 8459 | 281 | tempitem.misc4 = 0; | |
| 8460 | 281 | tempitem.misc5 = 0; | |
| 8461 | 281 | tempitem.misc6 = 0; | |
| 8462 | 281 | tempitem.misc7 = 0; | |
| 8463 | 281 | tempitem.misc8 = 0; | |
| 8464 | 281 | tempitem.misc9 = 0; | |
| 8465 | 281 | tempitem.misc10 = 0; | |
| 8466 | 281 | tempitem.wpn = 0; | |
| 8467 | 281 | tempitem.wpn2 = 0; | |
| 8468 | 281 | tempitem.wpn3 = 0; | |
| 8469 | 281 | tempitem.wpn4 = 0; | |
| 8470 | 281 | tempitem.wpn5 = 0; | |
| 8471 | 281 | tempitem.wpn6 = 0; | |
| 8472 | 281 | tempitem.wpn7 = 0; | |
| 8473 | 281 | tempitem.wpn8 = 0; | |
| 8474 | 281 | tempitem.wpn9 = 0; | |
| 8475 | 281 | tempitem.wpn10 = 0; | |
| 8476 | 281 | break; | |
| 8477 | } | ||
| 8478 | case itype_boots: | ||
| 8479 | { | ||
| 8480 | 284 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8481 | 284 | tempitem.misc1 = 0; | |
| 8482 | 284 | tempitem.misc2 = 0; | |
| 8483 | 284 | tempitem.misc3 = 0; | |
| 8484 | 284 | tempitem.misc4 = 0; | |
| 8485 | 284 | tempitem.misc5 = 0; | |
| 8486 | 284 | tempitem.misc6 = 0; | |
| 8487 | 284 | tempitem.misc7 = 0; | |
| 8488 | 284 | tempitem.misc8 = 0; | |
| 8489 | 284 | tempitem.misc9 = 0; | |
| 8490 | 284 | tempitem.misc10 = 0; | |
| 8491 | 284 | tempitem.wpn = 0; | |
| 8492 | 284 | tempitem.wpn2 = 0; | |
| 8493 | 284 | tempitem.wpn3 = 0; | |
| 8494 | 284 | tempitem.wpn4 = 0; | |
| 8495 | 284 | tempitem.wpn5 = 0; | |
| 8496 | 284 | tempitem.wpn6 = 0; | |
| 8497 | 284 | tempitem.wpn7 = 0; | |
| 8498 | 284 | tempitem.wpn8 = 0; | |
| 8499 | 284 | tempitem.wpn9 = 0; | |
| 8500 | 284 | tempitem.wpn10 = 0; | |
| 8501 | 284 | break; | |
| 8502 | } | ||
| 8503 | case itype_hookshot: | ||
| 8504 | { | ||
| 8505 | 558 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8506 | 558 | tempitem.misc5 = 0; | |
| 8507 | 558 | tempitem.misc6 = 0; | |
| 8508 | 558 | tempitem.misc7 = 0; | |
| 8509 | 558 | tempitem.misc8 = 0; | |
| 8510 | 558 | tempitem.misc9 = 0; | |
| 8511 | 558 | tempitem.misc10 = 0; | |
| 8512 | 558 | tempitem.wpn5 = 0; | |
| 8513 | 558 | tempitem.wpn6 = 0; | |
| 8514 | 558 | tempitem.wpn7 = 0; | |
| 8515 | 558 | tempitem.wpn8 = 0; | |
| 8516 | 558 | tempitem.wpn9 = 0; | |
| 8517 | 558 | tempitem.wpn10 = 0; | |
| 8518 | 558 | break; | |
| 8519 | } | ||
| 8520 | case itype_lens: | ||
| 8521 | { | ||
| 8522 | 254 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8523 | 254 | tempitem.misc2 = 0; | |
| 8524 | 254 | tempitem.misc3 = 0; | |
| 8525 | 254 | tempitem.misc4 = 0; | |
| 8526 | 254 | tempitem.misc5 = 0; | |
| 8527 | 254 | tempitem.misc6 = 0; | |
| 8528 | 254 | tempitem.misc7 = 0; | |
| 8529 | 254 | tempitem.misc8 = 0; | |
| 8530 | 254 | tempitem.misc9 = 0; | |
| 8531 | 254 | tempitem.misc10 = 0; | |
| 8532 | 254 | tempitem.wpn = 0; | |
| 8533 | 254 | tempitem.wpn2 = 0; | |
| 8534 | 254 | tempitem.wpn3 = 0; | |
| 8535 | 254 | tempitem.wpn4 = 0; | |
| 8536 | 254 | tempitem.wpn5 = 0; | |
| 8537 | 254 | tempitem.wpn6 = 0; | |
| 8538 | 254 | tempitem.wpn7 = 0; | |
| 8539 | 254 | tempitem.wpn8 = 0; | |
| 8540 | 254 | tempitem.wpn9 = 0; | |
| 8541 | 254 | tempitem.wpn10 = 0; | |
| 8542 | 254 | break; | |
| 8543 | } | ||
| 8544 | case itype_hammer: | ||
| 8545 | { | ||
| 8546 | 281 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8547 | 281 | tempitem.misc1 = 0; | |
| 8548 | 281 | tempitem.misc2 = 0; | |
| 8549 | 281 | tempitem.misc3 = 0; | |
| 8550 | 281 | tempitem.misc4 = 0; | |
| 8551 | 281 | tempitem.misc5 = 0; | |
| 8552 | 281 | tempitem.misc6 = 0; | |
| 8553 | 281 | tempitem.misc7 = 0; | |
| 8554 | 281 | tempitem.misc8 = 0; | |
| 8555 | 281 | tempitem.misc9 = 0; | |
| 8556 | 281 | tempitem.misc10 = 0; | |
| 8557 | 281 | tempitem.wpn3 = 0; | |
| 8558 | 281 | tempitem.wpn4 = 0; | |
| 8559 | 281 | tempitem.wpn5 = 0; | |
| 8560 | 281 | tempitem.wpn6 = 0; | |
| 8561 | 281 | tempitem.wpn7 = 0; | |
| 8562 | 281 | tempitem.wpn8 = 0; | |
| 8563 | 281 | tempitem.wpn9 = 0; | |
| 8564 | 281 | tempitem.wpn10 = 0; | |
| 8565 | 281 | break; | |
| 8566 | } | ||
| 8567 | case itype_divinefire: | ||
| 8568 | { | ||
| 8569 | 278 | tempitem.flags &= ~ (item_flag1 | item_flag4 | item_flag5); | |
| 8570 | 278 | tempitem.misc3 = 0; | |
| 8571 | 278 | tempitem.misc4 = 0; | |
| 8572 | 278 | tempitem.misc5 = 0; | |
| 8573 | 278 | tempitem.misc6 = 0; | |
| 8574 | 278 | tempitem.misc7 = 0; | |
| 8575 | 278 | tempitem.misc8 = 0; | |
| 8576 | 278 | tempitem.misc9 = 0; | |
| 8577 | 278 | tempitem.misc10 = 0; | |
| 8578 | 278 | tempitem.wpn6 = 0; | |
| 8579 | 278 | tempitem.wpn7 = 0; | |
| 8580 | 278 | tempitem.wpn8 = 0; | |
| 8581 | 278 | tempitem.wpn9 = 0; | |
| 8582 | 278 | tempitem.wpn10 = 0; | |
| 8583 | 278 | break; | |
| 8584 | } | ||
| 8585 | case itype_divineescape: | ||
| 8586 | { | ||
| 8587 | 278 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8588 | 278 | tempitem.misc2 = 0; | |
| 8589 | 278 | tempitem.misc3 = 0; | |
| 8590 | 278 | tempitem.misc4 = 0; | |
| 8591 | 278 | tempitem.misc5 = 0; | |
| 8592 | 278 | tempitem.misc6 = 0; | |
| 8593 | 278 | tempitem.misc7 = 0; | |
| 8594 | 278 | tempitem.misc8 = 0; | |
| 8595 | 278 | tempitem.misc9 = 0; | |
| 8596 | 278 | tempitem.misc10 = 0; | |
| 8597 | 278 | tempitem.wpn = 0; | |
| 8598 | 278 | tempitem.wpn2 = 0; | |
| 8599 | 278 | tempitem.wpn3 = 0; | |
| 8600 | 278 | tempitem.wpn4 = 0; | |
| 8601 | 278 | tempitem.wpn5 = 0; | |
| 8602 | 278 | tempitem.wpn6 = 0; | |
| 8603 | 278 | tempitem.wpn7 = 0; | |
| 8604 | 278 | tempitem.wpn8 = 0; | |
| 8605 | 278 | tempitem.wpn9 = 0; | |
| 8606 | 278 | tempitem.wpn10 = 0; | |
| 8607 | 278 | break; | |
| 8608 | } | ||
| 8609 | case itype_divineprotection: | ||
| 8610 | { | ||
| 8611 | 278 | tempitem.flags &= ~ (item_flag5); | |
| 8612 | 278 | tempitem.misc2 = 0; | |
| 8613 | 278 | tempitem.misc3 = 0; | |
| 8614 | 278 | tempitem.misc4 = 0; | |
| 8615 | 278 | tempitem.misc5 = 0; | |
| 8616 | 278 | tempitem.misc6 = 0; | |
| 8617 | 278 | tempitem.misc7 = 0; | |
| 8618 | 278 | tempitem.misc8 = 0; | |
| 8619 | 278 | tempitem.misc9 = 0; | |
| 8620 | 278 | tempitem.misc10 = 0; | |
| 8621 | 278 | break; | |
| 8622 | } | ||
| 8623 | case itype_bomb: | ||
| 8624 | { | ||
| 8625 | 294 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8626 | 294 | tempitem.misc4 = 0; | |
| 8627 | 294 | tempitem.misc5 = 0; | |
| 8628 | 294 | tempitem.misc6 = 0; | |
| 8629 | 294 | tempitem.misc7 = 0; | |
| 8630 | 294 | tempitem.misc8 = 0; | |
| 8631 | 294 | tempitem.misc9 = 0; | |
| 8632 | 294 | tempitem.misc10 = 0; | |
| 8633 | 294 | tempitem.wpn3 = 0; | |
| 8634 | 294 | tempitem.wpn4 = 0; | |
| 8635 | 294 | tempitem.wpn5 = 0; | |
| 8636 | 294 | tempitem.wpn6 = 0; | |
| 8637 | 294 | tempitem.wpn7 = 0; | |
| 8638 | 294 | tempitem.wpn8 = 0; | |
| 8639 | 294 | tempitem.wpn9 = 0; | |
| 8640 | 294 | tempitem.wpn10 = 0; | |
| 8641 | 294 | break; | |
| 8642 | } | ||
| 8643 | case itype_sbomb: | ||
| 8644 | { | ||
| 8645 | 280 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8646 | 280 | tempitem.misc4 = 0; | |
| 8647 | 280 | tempitem.misc5 = 0; | |
| 8648 | 280 | tempitem.misc6 = 0; | |
| 8649 | 280 | tempitem.misc7 = 0; | |
| 8650 | 280 | tempitem.misc8 = 0; | |
| 8651 | 280 | tempitem.misc9 = 0; | |
| 8652 | 280 | tempitem.misc10 = 0; | |
| 8653 | 280 | tempitem.wpn3 = 0; | |
| 8654 | 280 | tempitem.wpn4 = 0; | |
| 8655 | 280 | tempitem.wpn5 = 0; | |
| 8656 | 280 | tempitem.wpn6 = 0; | |
| 8657 | 280 | tempitem.wpn7 = 0; | |
| 8658 | 280 | tempitem.wpn8 = 0; | |
| 8659 | 280 | tempitem.wpn9 = 0; | |
| 8660 | 280 | tempitem.wpn10 = 0; | |
| 8661 | 280 | break; | |
| 8662 | } | ||
| 8663 | case itype_clock: | ||
| 8664 | { | ||
| 8665 | 281 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8666 | 281 | tempitem.misc2 = 0; | |
| 8667 | 281 | tempitem.misc3 = 0; | |
| 8668 | 281 | tempitem.misc4 = 0; | |
| 8669 | 281 | tempitem.misc5 = 0; | |
| 8670 | 281 | tempitem.misc6 = 0; | |
| 8671 | 281 | tempitem.misc7 = 0; | |
| 8672 | 281 | tempitem.misc8 = 0; | |
| 8673 | 281 | tempitem.misc9 = 0; | |
| 8674 | 281 | tempitem.misc10 = 0; | |
| 8675 | 281 | tempitem.wpn = 0; | |
| 8676 | 281 | tempitem.wpn2 = 0; | |
| 8677 | 281 | tempitem.wpn3 = 0; | |
| 8678 | 281 | tempitem.wpn4 = 0; | |
| 8679 | 281 | tempitem.wpn5 = 0; | |
| 8680 | 281 | tempitem.wpn6 = 0; | |
| 8681 | 281 | tempitem.wpn7 = 0; | |
| 8682 | 281 | tempitem.wpn8 = 0; | |
| 8683 | 281 | tempitem.wpn9 = 0; | |
| 8684 | 281 | tempitem.wpn10 = 0; | |
| 8685 | 281 | break; | |
| 8686 | } | ||
| 8687 | case itype_key: | ||
| 8688 | { | ||
| 8689 | 278 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8690 | 278 | tempitem.misc1 = 0; | |
| 8691 | 278 | tempitem.misc2 = 0; | |
| 8692 | 278 | tempitem.misc3 = 0; | |
| 8693 | 278 | tempitem.misc4 = 0; | |
| 8694 | 278 | tempitem.misc5 = 0; | |
| 8695 | 278 | tempitem.misc6 = 0; | |
| 8696 | 278 | tempitem.misc7 = 0; | |
| 8697 | 278 | tempitem.misc8 = 0; | |
| 8698 | 278 | tempitem.misc9 = 0; | |
| 8699 | 278 | tempitem.misc10 = 0; | |
| 8700 | 278 | tempitem.wpn = 0; | |
| 8701 | 278 | tempitem.wpn2 = 0; | |
| 8702 | 278 | tempitem.wpn3 = 0; | |
| 8703 | 278 | tempitem.wpn4 = 0; | |
| 8704 | 278 | tempitem.wpn5 = 0; | |
| 8705 | 278 | tempitem.wpn6 = 0; | |
| 8706 | 278 | tempitem.wpn7 = 0; | |
| 8707 | 278 | tempitem.wpn8 = 0; | |
| 8708 | 278 | tempitem.wpn9 = 0; | |
| 8709 | 278 | tempitem.wpn10 = 0; | |
| 8710 | 278 | break; | |
| 8711 | } | ||
| 8712 | case itype_magiccontainer: | ||
| 8713 | { | ||
| 8714 | 283 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8715 | 283 | tempitem.misc1 = 0; | |
| 8716 | 283 | tempitem.misc2 = 0; | |
| 8717 | 283 | tempitem.misc3 = 0; | |
| 8718 | 283 | tempitem.misc4 = 0; | |
| 8719 | 283 | tempitem.misc5 = 0; | |
| 8720 | 283 | tempitem.misc6 = 0; | |
| 8721 | 283 | tempitem.misc7 = 0; | |
| 8722 | 283 | tempitem.misc8 = 0; | |
| 8723 | 283 | tempitem.misc9 = 0; | |
| 8724 | 283 | tempitem.misc10 = 0; | |
| 8725 | 283 | tempitem.wpn = 0; | |
| 8726 | 283 | tempitem.wpn2 = 0; | |
| 8727 | 283 | tempitem.wpn3 = 0; | |
| 8728 | 283 | tempitem.wpn4 = 0; | |
| 8729 | 283 | tempitem.wpn5 = 0; | |
| 8730 | 283 | tempitem.wpn6 = 0; | |
| 8731 | 283 | tempitem.wpn7 = 0; | |
| 8732 | 283 | tempitem.wpn8 = 0; | |
| 8733 | 283 | tempitem.wpn9 = 0; | |
| 8734 | 283 | tempitem.wpn10 = 0; | |
| 8735 | 283 | break; | |
| 8736 | } | ||
| 8737 | case itype_triforcepiece: | ||
| 8738 | { | ||
| 8739 | 556 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8740 | 556 | tempitem.misc3 = 0; | |
| 8741 | 556 | tempitem.misc4 = 0; | |
| 8742 | 556 | tempitem.misc5 = 0; | |
| 8743 | 556 | tempitem.misc6 = 0; | |
| 8744 | 556 | tempitem.misc7 = 0; | |
| 8745 | 556 | tempitem.misc8 = 0; | |
| 8746 | 556 | tempitem.misc9 = 0; | |
| 8747 | 556 | tempitem.misc10 = 0; | |
| 8748 | 556 | tempitem.wpn = 0; | |
| 8749 | 556 | tempitem.wpn2 = 0; | |
| 8750 | 556 | tempitem.wpn3 = 0; | |
| 8751 | 556 | tempitem.wpn4 = 0; | |
| 8752 | 556 | tempitem.wpn5 = 0; | |
| 8753 | 556 | tempitem.wpn6 = 0; | |
| 8754 | 556 | tempitem.wpn7 = 0; | |
| 8755 | 556 | tempitem.wpn8 = 0; | |
| 8756 | 556 | tempitem.wpn9 = 0; | |
| 8757 | 556 | tempitem.wpn10 = 0; | |
| 8758 | 556 | break; | |
| 8759 | } | ||
| 8760 | case itype_map: case itype_compass: case itype_bosskey: | ||
| 8761 | { | ||
| 8762 | 839 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8763 | 839 | tempitem.misc1 = 0; | |
| 8764 | 839 | tempitem.misc2 = 0; | |
| 8765 | 839 | tempitem.misc3 = 0; | |
| 8766 | 839 | tempitem.misc4 = 0; | |
| 8767 | 839 | tempitem.misc5 = 0; | |
| 8768 | 839 | tempitem.misc6 = 0; | |
| 8769 | 839 | tempitem.misc7 = 0; | |
| 8770 | 839 | tempitem.misc8 = 0; | |
| 8771 | 839 | tempitem.misc9 = 0; | |
| 8772 | 839 | tempitem.misc10 = 0; | |
| 8773 | 839 | tempitem.wpn = 0; | |
| 8774 | 839 | tempitem.wpn2 = 0; | |
| 8775 | 839 | tempitem.wpn3 = 0; | |
| 8776 | 839 | tempitem.wpn4 = 0; | |
| 8777 | 839 | tempitem.wpn5 = 0; | |
| 8778 | 839 | tempitem.wpn6 = 0; | |
| 8779 | 839 | tempitem.wpn7 = 0; | |
| 8780 | 839 | tempitem.wpn8 = 0; | |
| 8781 | 839 | tempitem.wpn9 = 0; | |
| 8782 | 839 | tempitem.wpn10 = 0; | |
| 8783 | 839 | break; | |
| 8784 | } | ||
| 8785 | case itype_quiver: | ||
| 8786 | { | ||
| 8787 | 1112 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8788 | 1112 | tempitem.misc3 = 0; | |
| 8789 | 1112 | tempitem.misc4 = 0; | |
| 8790 | 1112 | tempitem.misc5 = 0; | |
| 8791 | 1112 | tempitem.misc6 = 0; | |
| 8792 | 1112 | tempitem.misc7 = 0; | |
| 8793 | 1112 | tempitem.misc8 = 0; | |
| 8794 | 1112 | tempitem.misc9 = 0; | |
| 8795 | 1112 | tempitem.misc10 = 0; | |
| 8796 | 1112 | tempitem.wpn = 0; | |
| 8797 | 1112 | tempitem.wpn2 = 0; | |
| 8798 | 1112 | tempitem.wpn3 = 0; | |
| 8799 | 1112 | tempitem.wpn4 = 0; | |
| 8800 | 1112 | tempitem.wpn5 = 0; | |
| 8801 | 1112 | tempitem.wpn6 = 0; | |
| 8802 | 1112 | tempitem.wpn7 = 0; | |
| 8803 | 1112 | tempitem.wpn8 = 0; | |
| 8804 | 1112 | tempitem.wpn9 = 0; | |
| 8805 | 1112 | tempitem.wpn10 = 0; | |
| 8806 | 1112 | break; | |
| 8807 | } | ||
| 8808 | case itype_lkey: | ||
| 8809 | { | ||
| 8810 | 779 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8811 | 779 | tempitem.misc1 = 0; | |
| 8812 | 779 | tempitem.misc2 = 0; | |
| 8813 | 779 | tempitem.misc3 = 0; | |
| 8814 | 779 | tempitem.misc4 = 0; | |
| 8815 | 779 | tempitem.misc5 = 0; | |
| 8816 | 779 | tempitem.misc6 = 0; | |
| 8817 | 779 | tempitem.misc7 = 0; | |
| 8818 | 779 | tempitem.misc8 = 0; | |
| 8819 | 779 | tempitem.misc9 = 0; | |
| 8820 | 779 | tempitem.misc10 = 0; | |
| 8821 | 779 | tempitem.wpn = 0; | |
| 8822 | 779 | tempitem.wpn2 = 0; | |
| 8823 | 779 | tempitem.wpn3 = 0; | |
| 8824 | 779 | tempitem.wpn4 = 0; | |
| 8825 | 779 | tempitem.wpn5 = 0; | |
| 8826 | 779 | tempitem.wpn6 = 0; | |
| 8827 | 779 | tempitem.wpn7 = 0; | |
| 8828 | 779 | tempitem.wpn8 = 0; | |
| 8829 | 779 | tempitem.wpn9 = 0; | |
| 8830 | 779 | tempitem.wpn10 = 0; | |
| 8831 | 779 | break; | |
| 8832 | } | ||
| 8833 | case itype_cbyrna: | ||
| 8834 | { | ||
| 8835 | 278 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag5); | |
| 8836 | 278 | tempitem.misc4 = 0; | |
| 8837 | 278 | tempitem.misc5 = 0; | |
| 8838 | 278 | tempitem.misc6 = 0; | |
| 8839 | 278 | tempitem.misc7 = 0; | |
| 8840 | 278 | tempitem.misc8 = 0; | |
| 8841 | 278 | tempitem.misc9 = 0; | |
| 8842 | 278 | tempitem.misc10 = 0; | |
| 8843 | 278 | tempitem.wpn6 = 0; | |
| 8844 | 278 | tempitem.wpn7 = 0; | |
| 8845 | 278 | tempitem.wpn8 = 0; | |
| 8846 | 278 | tempitem.wpn9 = 0; | |
| 8847 | 278 | tempitem.wpn10 = 0; | |
| 8848 | 278 | break; | |
| 8849 | } | ||
| 8850 | case itype_rupee: case itype_arrowammo: | ||
| 8851 | { | ||
| 8852 | 3250 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8853 | 3250 | tempitem.misc1 = 0; | |
| 8854 | 3250 | tempitem.misc2 = 0; | |
| 8855 | 3250 | tempitem.misc3 = 0; | |
| 8856 | 3250 | tempitem.misc4 = 0; | |
| 8857 | 3250 | tempitem.misc5 = 0; | |
| 8858 | 3250 | tempitem.misc6 = 0; | |
| 8859 | 3250 | tempitem.misc7 = 0; | |
| 8860 | 3250 | tempitem.misc8 = 0; | |
| 8861 | 3250 | tempitem.misc9 = 0; | |
| 8862 | 3250 | tempitem.misc10 = 0; | |
| 8863 | 3250 | tempitem.wpn = 0; | |
| 8864 | 3250 | tempitem.wpn2 = 0; | |
| 8865 | 3250 | tempitem.wpn3 = 0; | |
| 8866 | 3250 | tempitem.wpn4 = 0; | |
| 8867 | 3250 | tempitem.wpn5 = 0; | |
| 8868 | 3250 | tempitem.wpn6 = 0; | |
| 8869 | 3250 | tempitem.wpn7 = 0; | |
| 8870 | 3250 | tempitem.wpn8 = 0; | |
| 8871 | 3250 | tempitem.wpn9 = 0; | |
| 8872 | 3250 | tempitem.wpn10 = 0; | |
| 8873 | 3250 | break; | |
| 8874 | } | ||
| 8875 | case itype_fairy: | ||
| 8876 | { | ||
| 8877 | 543 | tempitem.flags &= ~ (item_flag3 | item_flag4 | item_flag5); | |
| 8878 | 543 | tempitem.misc4 = 0; | |
| 8879 | 543 | tempitem.misc5 = 0; | |
| 8880 | 543 | tempitem.misc6 = 0; | |
| 8881 | 543 | tempitem.misc7 = 0; | |
| 8882 | 543 | tempitem.misc8 = 0; | |
| 8883 | 543 | tempitem.misc9 = 0; | |
| 8884 | 543 | tempitem.misc10 = 0; | |
| 8885 | 543 | tempitem.wpn = 0; | |
| 8886 | 543 | tempitem.wpn2 = 0; | |
| 8887 | 543 | tempitem.wpn3 = 0; | |
| 8888 | 543 | tempitem.wpn4 = 0; | |
| 8889 | 543 | tempitem.wpn5 = 0; | |
| 8890 | 543 | tempitem.wpn6 = 0; | |
| 8891 | 543 | tempitem.wpn7 = 0; | |
| 8892 | 543 | tempitem.wpn8 = 0; | |
| 8893 | 543 | tempitem.wpn9 = 0; | |
| 8894 | 543 | tempitem.wpn10 = 0; | |
| 8895 | 543 | break; | |
| 8896 | } | ||
| 8897 | case itype_magic: case itype_heart: case itype_heartcontainer: case itype_heartpiece: case itype_killem: case itype_bombammo: | ||
| 8898 | { | ||
| 8899 | 2862 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8900 | 2862 | tempitem.misc1 = 0; | |
| 8901 | 2862 | tempitem.misc2 = 0; | |
| 8902 | 2862 | tempitem.misc3 = 0; | |
| 8903 | 2862 | tempitem.misc4 = 0; | |
| 8904 | 2862 | tempitem.misc5 = 0; | |
| 8905 | 2862 | tempitem.misc6 = 0; | |
| 8906 | 2862 | tempitem.misc7 = 0; | |
| 8907 | 2862 | tempitem.misc8 = 0; | |
| 8908 | 2862 | tempitem.misc9 = 0; | |
| 8909 | 2862 | tempitem.misc10 = 0; | |
| 8910 | 2862 | tempitem.wpn = 0; | |
| 8911 | 2862 | tempitem.wpn2 = 0; | |
| 8912 | 2862 | tempitem.wpn3 = 0; | |
| 8913 | 2862 | tempitem.wpn4 = 0; | |
| 8914 | 2862 | tempitem.wpn5 = 0; | |
| 8915 | 2862 | tempitem.wpn6 = 0; | |
| 8916 | 2862 | tempitem.wpn7 = 0; | |
| 8917 | 2862 | tempitem.wpn8 = 0; | |
| 8918 | 2862 | tempitem.wpn9 = 0; | |
| 8919 | 2862 | tempitem.wpn10 = 0; | |
| 8920 | 2862 | break; | |
| 8921 | } | ||
| 8922 | case itype_bombbag: | ||
| 8923 | { | ||
| 8924 | 1112 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8925 | 1112 | tempitem.misc3 = 0; | |
| 8926 | 1112 | tempitem.misc4 = 0; | |
| 8927 | 1112 | tempitem.misc5 = 0; | |
| 8928 | 1112 | tempitem.misc6 = 0; | |
| 8929 | 1112 | tempitem.misc7 = 0; | |
| 8930 | 1112 | tempitem.misc8 = 0; | |
| 8931 | 1112 | tempitem.misc9 = 0; | |
| 8932 | 1112 | tempitem.misc10 = 0; | |
| 8933 | 1112 | tempitem.wpn = 0; | |
| 8934 | 1112 | tempitem.wpn2 = 0; | |
| 8935 | 1112 | tempitem.wpn3 = 0; | |
| 8936 | 1112 | tempitem.wpn4 = 0; | |
| 8937 | 1112 | tempitem.wpn5 = 0; | |
| 8938 | 1112 | tempitem.wpn6 = 0; | |
| 8939 | 1112 | tempitem.wpn7 = 0; | |
| 8940 | 1112 | tempitem.wpn8 = 0; | |
| 8941 | 1112 | tempitem.wpn9 = 0; | |
| 8942 | 1112 | tempitem.wpn10 = 0; | |
| 8943 | 1112 | break; | |
| 8944 | } | ||
| 8945 | case itype_rocs: | ||
| 8946 | { | ||
| 8947 | 278 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8948 | 278 | tempitem.misc1 = 0; | |
| 8949 | 278 | tempitem.misc2 = 0; | |
| 8950 | 278 | tempitem.misc3 = 0; | |
| 8951 | 278 | tempitem.misc4 = 0; | |
| 8952 | 278 | tempitem.misc5 = 0; | |
| 8953 | 278 | tempitem.misc6 = 0; | |
| 8954 | 278 | tempitem.misc7 = 0; | |
| 8955 | 278 | tempitem.misc8 = 0; | |
| 8956 | 278 | tempitem.misc9 = 0; | |
| 8957 | 278 | tempitem.misc10 = 0; | |
| 8958 | 278 | tempitem.wpn = 0; | |
| 8959 | 278 | tempitem.wpn2 = 0; | |
| 8960 | 278 | tempitem.wpn3 = 0; | |
| 8961 | 278 | tempitem.wpn4 = 0; | |
| 8962 | 278 | tempitem.wpn5 = 0; | |
| 8963 | 278 | tempitem.wpn6 = 0; | |
| 8964 | 278 | tempitem.wpn7 = 0; | |
| 8965 | 278 | tempitem.wpn8 = 0; | |
| 8966 | 278 | tempitem.wpn9 = 0; | |
| 8967 | 278 | tempitem.wpn10 = 0; | |
| 8968 | 278 | break; | |
| 8969 | } | ||
| 8970 | case itype_hoverboots: | ||
| 8971 | { | ||
| 8972 | 278 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8973 | 278 | tempitem.misc2 = 0; | |
| 8974 | 278 | tempitem.misc3 = 0; | |
| 8975 | 278 | tempitem.misc4 = 0; | |
| 8976 | 278 | tempitem.misc5 = 0; | |
| 8977 | 278 | tempitem.misc6 = 0; | |
| 8978 | 278 | tempitem.misc7 = 0; | |
| 8979 | 278 | tempitem.misc8 = 0; | |
| 8980 | 278 | tempitem.misc9 = 0; | |
| 8981 | 278 | tempitem.misc10 = 0; | |
| 8982 | 278 | tempitem.wpn2 = 0; | |
| 8983 | 278 | tempitem.wpn3 = 0; | |
| 8984 | 278 | tempitem.wpn4 = 0; | |
| 8985 | 278 | tempitem.wpn5 = 0; | |
| 8986 | 278 | tempitem.wpn6 = 0; | |
| 8987 | 278 | tempitem.wpn7 = 0; | |
| 8988 | 278 | tempitem.wpn8 = 0; | |
| 8989 | 278 | tempitem.wpn9 = 0; | |
| 8990 | 278 | tempitem.wpn10 = 0; | |
| 8991 | 278 | break; | |
| 8992 | } | ||
| 8993 | case itype_spinscroll: | ||
| 8994 | { | ||
| 8995 | 278 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8996 | 278 | tempitem.misc2 = 0; | |
| 8997 | 278 | tempitem.misc3 = 0; | |
| 8998 | 278 | tempitem.misc4 = 0; | |
| 8999 | 278 | tempitem.misc5 = 0; | |
| 9000 | 278 | tempitem.misc6 = 0; | |
| 9001 | 278 | tempitem.misc7 = 0; | |
| 9002 | 278 | tempitem.misc8 = 0; | |
| 9003 | 278 | tempitem.misc9 = 0; | |
| 9004 | 278 | tempitem.misc10 = 0; | |
| 9005 | 278 | tempitem.wpn = 0; | |
| 9006 | 278 | tempitem.wpn2 = 0; | |
| 9007 | 278 | tempitem.wpn3 = 0; | |
| 9008 | 278 | tempitem.wpn4 = 0; | |
| 9009 | 278 | tempitem.wpn5 = 0; | |
| 9010 | 278 | tempitem.wpn6 = 0; | |
| 9011 | 278 | tempitem.wpn7 = 0; | |
| 9012 | 278 | tempitem.wpn8 = 0; | |
| 9013 | 278 | tempitem.wpn9 = 0; | |
| 9014 | 278 | tempitem.wpn10 = 0; | |
| 9015 | 278 | break; | |
| 9016 | } | ||
| 9017 | case itype_crossscroll: | ||
| 9018 | { | ||
| 9019 | 278 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9020 | 278 | tempitem.misc1 = 0; | |
| 9021 | 278 | tempitem.misc2 = 0; | |
| 9022 | 278 | tempitem.misc3 = 0; | |
| 9023 | 278 | tempitem.misc4 = 0; | |
| 9024 | 278 | tempitem.misc5 = 0; | |
| 9025 | 278 | tempitem.misc6 = 0; | |
| 9026 | 278 | tempitem.misc7 = 0; | |
| 9027 | 278 | tempitem.misc8 = 0; | |
| 9028 | 278 | tempitem.misc9 = 0; | |
| 9029 | 278 | tempitem.misc10 = 0; | |
| 9030 | 278 | tempitem.wpn = 0; | |
| 9031 | 278 | tempitem.wpn2 = 0; | |
| 9032 | 278 | tempitem.wpn3 = 0; | |
| 9033 | 278 | tempitem.wpn4 = 0; | |
| 9034 | 278 | tempitem.wpn5 = 0; | |
| 9035 | 278 | tempitem.wpn6 = 0; | |
| 9036 | 278 | tempitem.wpn7 = 0; | |
| 9037 | 278 | tempitem.wpn8 = 0; | |
| 9038 | 278 | tempitem.wpn9 = 0; | |
| 9039 | 278 | tempitem.wpn10 = 0; | |
| 9040 | 278 | break; | |
| 9041 | } | ||
| 9042 | case itype_quakescroll: | ||
| 9043 | { | ||
| 9044 | 278 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9045 | 278 | tempitem.misc3 = 0; | |
| 9046 | 278 | tempitem.misc4 = 0; | |
| 9047 | 278 | tempitem.misc5 = 0; | |
| 9048 | 278 | tempitem.misc6 = 0; | |
| 9049 | 278 | tempitem.misc7 = 0; | |
| 9050 | 278 | tempitem.misc8 = 0; | |
| 9051 | 278 | tempitem.misc9 = 0; | |
| 9052 | 278 | tempitem.misc10 = 0; | |
| 9053 | 278 | tempitem.wpn = 0; | |
| 9054 | 278 | tempitem.wpn2 = 0; | |
| 9055 | 278 | tempitem.wpn3 = 0; | |
| 9056 | 278 | tempitem.wpn4 = 0; | |
| 9057 | 278 | tempitem.wpn5 = 0; | |
| 9058 | 278 | tempitem.wpn6 = 0; | |
| 9059 | 278 | tempitem.wpn7 = 0; | |
| 9060 | 278 | tempitem.wpn8 = 0; | |
| 9061 | 278 | tempitem.wpn9 = 0; | |
| 9062 | 278 | tempitem.wpn10 = 0; | |
| 9063 | 278 | break; | |
| 9064 | } | ||
| 9065 | case itype_whispring: | ||
| 9066 | { | ||
| 9067 | 559 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9068 | 559 | tempitem.misc2 = 0; | |
| 9069 | 559 | tempitem.misc3 = 0; | |
| 9070 | 559 | tempitem.misc4 = 0; | |
| 9071 | 559 | tempitem.misc5 = 0; | |
| 9072 | 559 | tempitem.misc6 = 0; | |
| 9073 | 559 | tempitem.misc7 = 0; | |
| 9074 | 559 | tempitem.misc8 = 0; | |
| 9075 | 559 | tempitem.misc9 = 0; | |
| 9076 | 559 | tempitem.misc10 = 0; | |
| 9077 | 559 | tempitem.wpn = 0; | |
| 9078 | 559 | tempitem.wpn2 = 0; | |
| 9079 | 559 | tempitem.wpn3 = 0; | |
| 9080 | 559 | tempitem.wpn4 = 0; | |
| 9081 | 559 | tempitem.wpn5 = 0; | |
| 9082 | 559 | tempitem.wpn6 = 0; | |
| 9083 | 559 | tempitem.wpn7 = 0; | |
| 9084 | 559 | tempitem.wpn8 = 0; | |
| 9085 | 559 | tempitem.wpn9 = 0; | |
| 9086 | 559 | tempitem.wpn10 = 0; | |
| 9087 | 559 | break; | |
| 9088 | } | ||
| 9089 | case itype_chargering: | ||
| 9090 | { | ||
| 9091 | 556 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9092 | 556 | tempitem.misc3 = 0; | |
| 9093 | 556 | tempitem.misc4 = 0; | |
| 9094 | 556 | tempitem.misc5 = 0; | |
| 9095 | 556 | tempitem.misc6 = 0; | |
| 9096 | 556 | tempitem.misc7 = 0; | |
| 9097 | 556 | tempitem.misc8 = 0; | |
| 9098 | 556 | tempitem.misc9 = 0; | |
| 9099 | 556 | tempitem.misc10 = 0; | |
| 9100 | 556 | tempitem.wpn = 0; | |
| 9101 | 556 | tempitem.wpn2 = 0; | |
| 9102 | 556 | tempitem.wpn3 = 0; | |
| 9103 | 556 | tempitem.wpn4 = 0; | |
| 9104 | 556 | tempitem.wpn5 = 0; | |
| 9105 | 556 | tempitem.wpn6 = 0; | |
| 9106 | 556 | tempitem.wpn7 = 0; | |
| 9107 | 556 | tempitem.wpn8 = 0; | |
| 9108 | 556 | tempitem.wpn9 = 0; | |
| 9109 | 556 | tempitem.wpn10 = 0; | |
| 9110 | 556 | break; | |
| 9111 | } | ||
| 9112 | case itype_perilscroll: | ||
| 9113 | { | ||
| 9114 | 278 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9115 | 278 | tempitem.misc2 = 0; | |
| 9116 | 278 | tempitem.misc3 = 0; | |
| 9117 | 278 | tempitem.misc4 = 0; | |
| 9118 | 278 | tempitem.misc5 = 0; | |
| 9119 | 278 | tempitem.misc6 = 0; | |
| 9120 | 278 | tempitem.misc7 = 0; | |
| 9121 | 278 | tempitem.misc8 = 0; | |
| 9122 | 278 | tempitem.misc9 = 0; | |
| 9123 | 278 | tempitem.misc10 = 0; | |
| 9124 | 278 | tempitem.wpn = 0; | |
| 9125 | 278 | tempitem.wpn2 = 0; | |
| 9126 | 278 | tempitem.wpn3 = 0; | |
| 9127 | 278 | tempitem.wpn4 = 0; | |
| 9128 | 278 | tempitem.wpn5 = 0; | |
| 9129 | 278 | tempitem.wpn6 = 0; | |
| 9130 | 278 | tempitem.wpn7 = 0; | |
| 9131 | 278 | tempitem.wpn8 = 0; | |
| 9132 | 278 | tempitem.wpn9 = 0; | |
| 9133 | 278 | tempitem.wpn10 = 0; | |
| 9134 | 278 | break; | |
| 9135 | } | ||
| 9136 | case itype_wealthmedal: | ||
| 9137 | { | ||
| 9138 | 837 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9139 | 837 | tempitem.misc2 = 0; | |
| 9140 | 837 | tempitem.misc3 = 0; | |
| 9141 | 837 | tempitem.misc4 = 0; | |
| 9142 | 837 | tempitem.misc5 = 0; | |
| 9143 | 837 | tempitem.misc6 = 0; | |
| 9144 | 837 | tempitem.misc7 = 0; | |
| 9145 | 837 | tempitem.misc8 = 0; | |
| 9146 | 837 | tempitem.misc9 = 0; | |
| 9147 | 837 | tempitem.misc10 = 0; | |
| 9148 | 837 | tempitem.wpn = 0; | |
| 9149 | 837 | tempitem.wpn2 = 0; | |
| 9150 | 837 | tempitem.wpn3 = 0; | |
| 9151 | 837 | tempitem.wpn4 = 0; | |
| 9152 | 837 | tempitem.wpn5 = 0; | |
| 9153 | 837 | tempitem.wpn6 = 0; | |
| 9154 | 837 | tempitem.wpn7 = 0; | |
| 9155 | 837 | tempitem.wpn8 = 0; | |
| 9156 | 837 | tempitem.wpn9 = 0; | |
| 9157 | 837 | tempitem.wpn10 = 0; | |
| 9158 | 837 | break; | |
| 9159 | } | ||
| 9160 | case itype_heartring: | ||
| 9161 | { | ||
| 9162 | 840 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9163 | 840 | tempitem.misc3 = 0; | |
| 9164 | 840 | tempitem.misc4 = 0; | |
| 9165 | 840 | tempitem.misc5 = 0; | |
| 9166 | 840 | tempitem.misc6 = 0; | |
| 9167 | 840 | tempitem.misc7 = 0; | |
| 9168 | 840 | tempitem.misc8 = 0; | |
| 9169 | 840 | tempitem.misc9 = 0; | |
| 9170 | 840 | tempitem.misc10 = 0; | |
| 9171 | 840 | tempitem.wpn = 0; | |
| 9172 | 840 | tempitem.wpn2 = 0; | |
| 9173 | 840 | tempitem.wpn3 = 0; | |
| 9174 | 840 | tempitem.wpn4 = 0; | |
| 9175 | 840 | tempitem.wpn5 = 0; | |
| 9176 | 840 | tempitem.wpn6 = 0; | |
| 9177 | 840 | tempitem.wpn7 = 0; | |
| 9178 | 840 | tempitem.wpn8 = 0; | |
| 9179 | 840 | tempitem.wpn9 = 0; | |
| 9180 | 840 | tempitem.wpn10 = 0; | |
| 9181 | 840 | break; | |
| 9182 | } | ||
| 9183 | case itype_magicring: | ||
| 9184 | { | ||
| 9185 | 1124 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9186 | 1124 | tempitem.misc3 = 0; | |
| 9187 | 1124 | tempitem.misc4 = 0; | |
| 9188 | 1124 | tempitem.misc5 = 0; | |
| 9189 | 1124 | tempitem.misc6 = 0; | |
| 9190 | 1124 | tempitem.misc7 = 0; | |
| 9191 | 1124 | tempitem.misc8 = 0; | |
| 9192 | 1124 | tempitem.misc9 = 0; | |
| 9193 | 1124 | tempitem.misc10 = 0; | |
| 9194 | 1124 | tempitem.wpn = 0; | |
| 9195 | 1124 | tempitem.wpn2 = 0; | |
| 9196 | 1124 | tempitem.wpn3 = 0; | |
| 9197 | 1124 | tempitem.wpn4 = 0; | |
| 9198 | 1124 | tempitem.wpn5 = 0; | |
| 9199 | 1124 | tempitem.wpn6 = 0; | |
| 9200 | 1124 | tempitem.wpn7 = 0; | |
| 9201 | 1124 | tempitem.wpn8 = 0; | |
| 9202 | 1124 | tempitem.wpn9 = 0; | |
| 9203 | 1124 | tempitem.wpn10 = 0; | |
| 9204 | 1124 | break; | |
| 9205 | } | ||
| 9206 | case itype_spinscroll2: | ||
| 9207 | { | ||
| 9208 | 278 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9209 | 278 | tempitem.misc2 = 0; | |
| 9210 | 278 | tempitem.misc3 = 0; | |
| 9211 | 278 | tempitem.misc4 = 0; | |
| 9212 | 278 | tempitem.misc5 = 0; | |
| 9213 | 278 | tempitem.misc6 = 0; | |
| 9214 | 278 | tempitem.misc7 = 0; | |
| 9215 | 278 | tempitem.misc8 = 0; | |
| 9216 | 278 | tempitem.misc9 = 0; | |
| 9217 | 278 | tempitem.misc10 = 0; | |
| 9218 | 278 | tempitem.wpn = 0; | |
| 9219 | 278 | tempitem.wpn2 = 0; | |
| 9220 | 278 | tempitem.wpn3 = 0; | |
| 9221 | 278 | tempitem.wpn4 = 0; | |
| 9222 | 278 | tempitem.wpn5 = 0; | |
| 9223 | 278 | tempitem.wpn6 = 0; | |
| 9224 | 278 | tempitem.wpn7 = 0; | |
| 9225 | 278 | tempitem.wpn8 = 0; | |
| 9226 | 278 | tempitem.wpn9 = 0; | |
| 9227 | 278 | tempitem.wpn10 = 0; | |
| 9228 | 278 | break; | |
| 9229 | } | ||
| 9230 | case itype_quakescroll2: | ||
| 9231 | { | ||
| 9232 | 278 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9233 | 278 | tempitem.misc3 = 0; | |
| 9234 | 278 | tempitem.misc4 = 0; | |
| 9235 | 278 | tempitem.misc5 = 0; | |
| 9236 | 278 | tempitem.misc6 = 0; | |
| 9237 | 278 | tempitem.misc7 = 0; | |
| 9238 | 278 | tempitem.misc8 = 0; | |
| 9239 | 278 | tempitem.misc9 = 0; | |
| 9240 | 278 | tempitem.misc10 = 0; | |
| 9241 | 278 | tempitem.wpn = 0; | |
| 9242 | 278 | tempitem.wpn2 = 0; | |
| 9243 | 278 | tempitem.wpn3 = 0; | |
| 9244 | 278 | tempitem.wpn4 = 0; | |
| 9245 | 278 | tempitem.wpn5 = 0; | |
| 9246 | 278 | tempitem.wpn6 = 0; | |
| 9247 | 278 | tempitem.wpn7 = 0; | |
| 9248 | 278 | tempitem.wpn8 = 0; | |
| 9249 | 278 | tempitem.wpn9 = 0; | |
| 9250 | 278 | tempitem.wpn10 = 0; | |
| 9251 | 278 | break; | |
| 9252 | } | ||
| 9253 | case itype_agony: | ||
| 9254 | { | ||
| 9255 | 278 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9256 | 278 | tempitem.misc2 = 0; | |
| 9257 | 278 | tempitem.misc3 = 0; | |
| 9258 | 278 | tempitem.misc4 = 0; | |
| 9259 | 278 | tempitem.misc5 = 0; | |
| 9260 | 278 | tempitem.misc6 = 0; | |
| 9261 | 278 | tempitem.misc7 = 0; | |
| 9262 | 278 | tempitem.misc8 = 0; | |
| 9263 | 278 | tempitem.misc9 = 0; | |
| 9264 | 278 | tempitem.misc10 = 0; | |
| 9265 | 278 | tempitem.wpn = 0; | |
| 9266 | 278 | tempitem.wpn2 = 0; | |
| 9267 | 278 | tempitem.wpn3 = 0; | |
| 9268 | 278 | tempitem.wpn4 = 0; | |
| 9269 | 278 | tempitem.wpn5 = 0; | |
| 9270 | 278 | tempitem.wpn6 = 0; | |
| 9271 | 278 | tempitem.wpn7 = 0; | |
| 9272 | 278 | tempitem.wpn8 = 0; | |
| 9273 | 278 | tempitem.wpn9 = 0; | |
| 9274 | 278 | tempitem.wpn10 = 0; | |
| 9275 | 278 | break; | |
| 9276 | } | ||
| 9277 | case itype_stompboots: | ||
| 9278 | { | ||
| 9279 | 278 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9280 | 278 | tempitem.misc1 = 0; | |
| 9281 | 278 | tempitem.misc2 = 0; | |
| 9282 | 278 | tempitem.misc3 = 0; | |
| 9283 | 278 | tempitem.misc4 = 0; | |
| 9284 | 278 | tempitem.misc5 = 0; | |
| 9285 | 278 | tempitem.misc6 = 0; | |
| 9286 | 278 | tempitem.misc7 = 0; | |
| 9287 | 278 | tempitem.misc8 = 0; | |
| 9288 | 278 | tempitem.misc9 = 0; | |
| 9289 | 278 | tempitem.misc10 = 0; | |
| 9290 | 278 | tempitem.wpn = 0; | |
| 9291 | 278 | tempitem.wpn2 = 0; | |
| 9292 | 278 | tempitem.wpn3 = 0; | |
| 9293 | 278 | tempitem.wpn4 = 0; | |
| 9294 | 278 | tempitem.wpn5 = 0; | |
| 9295 | 278 | tempitem.wpn6 = 0; | |
| 9296 | 278 | tempitem.wpn7 = 0; | |
| 9297 | 278 | tempitem.wpn8 = 0; | |
| 9298 | 278 | tempitem.wpn9 = 0; | |
| 9299 | 278 | tempitem.wpn10 = 0; | |
| 9300 | 278 | break; | |
| 9301 | } | ||
| 9302 | case itype_whimsicalring: | ||
| 9303 | { | ||
| 9304 | 278 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9305 | 278 | tempitem.misc2 = 0; | |
| 9306 | 278 | tempitem.misc3 = 0; | |
| 9307 | 278 | tempitem.misc4 = 0; | |
| 9308 | 278 | tempitem.misc5 = 0; | |
| 9309 | 278 | tempitem.misc6 = 0; | |
| 9310 | 278 | tempitem.misc7 = 0; | |
| 9311 | 278 | tempitem.misc8 = 0; | |
| 9312 | 278 | tempitem.misc9 = 0; | |
| 9313 | 278 | tempitem.misc10 = 0; | |
| 9314 | 278 | tempitem.wpn = 0; | |
| 9315 | 278 | tempitem.wpn2 = 0; | |
| 9316 | 278 | tempitem.wpn3 = 0; | |
| 9317 | 278 | tempitem.wpn4 = 0; | |
| 9318 | 278 | tempitem.wpn5 = 0; | |
| 9319 | 278 | tempitem.wpn6 = 0; | |
| 9320 | 278 | tempitem.wpn7 = 0; | |
| 9321 | 278 | tempitem.wpn8 = 0; | |
| 9322 | 278 | tempitem.wpn9 = 0; | |
| 9323 | 278 | tempitem.wpn10 = 0; | |
| 9324 | 278 | break; | |
| 9325 | } | ||
| 9326 | case itype_perilring: | ||
| 9327 | { | ||
| 9328 | 305 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9329 | 305 | tempitem.misc2 = 0; | |
| 9330 | 305 | tempitem.misc3 = 0; | |
| 9331 | 305 | tempitem.misc4 = 0; | |
| 9332 | 305 | tempitem.misc5 = 0; | |
| 9333 | 305 | tempitem.misc6 = 0; | |
| 9334 | 305 | tempitem.misc7 = 0; | |
| 9335 | 305 | tempitem.misc8 = 0; | |
| 9336 | 305 | tempitem.misc9 = 0; | |
| 9337 | 305 | tempitem.misc10 = 0; | |
| 9338 | 305 | tempitem.wpn = 0; | |
| 9339 | 305 | tempitem.wpn2 = 0; | |
| 9340 | 305 | tempitem.wpn3 = 0; | |
| 9341 | 305 | tempitem.wpn4 = 0; | |
| 9342 | 305 | tempitem.wpn5 = 0; | |
| 9343 | 305 | tempitem.wpn6 = 0; | |
| 9344 | 305 | tempitem.wpn7 = 0; | |
| 9345 | 305 | tempitem.wpn8 = 0; | |
| 9346 | 305 | tempitem.wpn9 = 0; | |
| 9347 | 305 | tempitem.wpn10 = 0; | |
| 9348 | 305 | break; | |
| 9349 | } | ||
| 9350 | case itype_custom1: case itype_custom2: case itype_custom3: case itype_custom4: case itype_custom5: | ||
| 9351 | case itype_custom6: case itype_custom7: case itype_custom8: case itype_custom9: case itype_custom10: | ||
| 9352 | case itype_custom11: case itype_custom12: case itype_custom13: case itype_custom14: case itype_custom15: | ||
| 9353 | case itype_custom16: case itype_custom17: case itype_custom18: case itype_custom19: case itype_custom20: | ||
| 9354 | case itype_bowandarrow: case itype_letterpotion: case itype_misc: | ||
| 9355 | { | ||
| 9356 | 10647 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9357 | 10647 | tempitem.misc1 = 0; | |
| 9358 | 10647 | tempitem.misc2 = 0; | |
| 9359 | 10647 | tempitem.misc3 = 0; | |
| 9360 | 10647 | tempitem.misc4 = 0; | |
| 9361 | 10647 | tempitem.misc5 = 0; | |
| 9362 | 10647 | tempitem.misc6 = 0; | |
| 9363 | 10647 | tempitem.misc7 = 0; | |
| 9364 | 10647 | tempitem.misc8 = 0; | |
| 9365 | 10647 | tempitem.misc9 = 0; | |
| 9366 | 10647 | tempitem.misc10 = 0; | |
| 9367 | 10647 | tempitem.wpn = 0; | |
| 9368 | 10647 | tempitem.wpn2 = 0; | |
| 9369 | 10647 | tempitem.wpn3 = 0; | |
| 9370 | 10647 | tempitem.wpn4 = 0; | |
| 9371 | 10647 | tempitem.wpn5 = 0; | |
| 9372 | 10647 | tempitem.wpn6 = 0; | |
| 9373 | 10647 | tempitem.wpn7 = 0; | |
| 9374 | 10647 | tempitem.wpn8 = 0; | |
| 9375 | 10647 | tempitem.wpn9 = 0; | |
| 9376 | 10647 | tempitem.wpn10 = 0; | |
| 9377 | 10647 | break; | |
| 9378 | } | ||
| 9379 | } | ||
| 9380 | 71936 | } | |
| 9381 | //Port quest rules to items | ||
| 9382 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 71936 times.
|
126976 | if( s_version <= 31) |
| 9383 | { | ||
| 9384 |
2/2✓ Branch 0 taken 294 times.
✓ Branch 1 taken 71642 times.
|
71936 | if(tempitem.type == itype_bomb) |
| 9385 | { | ||
| 9386 |
2/2✓ Branch 0 taken 155 times.
✓ Branch 1 taken 139 times.
|
294 | if ( get_qr(qr_OUCHBOMBS) ) tempitem.flags |= item_flag2; |
| 9387 | 139 | else tempitem.flags &= ~ item_flag2; | |
| 9388 | 294 | } | |
| 9389 |
2/2✓ Branch 0 taken 280 times.
✓ Branch 1 taken 71362 times.
|
71642 | else if(tempitem.type == itype_sbomb) |
| 9390 | { | ||
| 9391 |
2/2✓ Branch 0 taken 157 times.
✓ Branch 1 taken 123 times.
|
280 | if ( get_qr(qr_OUCHBOMBS) ) tempitem.flags |= item_flag2; |
| 9392 | 123 | else tempitem.flags &= ~ item_flag2; | |
| 9393 | 280 | } | |
| 9394 | |||
| 9395 |
2/2✓ Branch 0 taken 841 times.
✓ Branch 1 taken 70521 times.
|
71362 | else if(tempitem.type == itype_brang) |
| 9396 | { | ||
| 9397 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 841 times.
|
841 | if ( get_qr(qr_BRANGPICKUP) ) tempitem.flags |= item_flag4; |
| 9398 | 841 | else tempitem.flags &= ~ item_flag4; | |
| 9399 | 841 | } | |
| 9400 |
2/2✓ Branch 0 taken 70225 times.
✓ Branch 1 taken 296 times.
|
70521 | else if(tempitem.type == itype_wand) |
| 9401 | { | ||
| 9402 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 278 times.
|
296 | if ( get_qr(qr_NOWANDMELEE) ) tempitem.flags |= item_flag3; |
| 9403 | 278 | else tempitem.flags &= ~ item_flag3; | |
| 9404 | 296 | } | |
| 9405 | 71936 | } | |
| 9406 | |||
| 9407 | //Port quest rules to items | ||
| 9408 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 71936 times.
|
126976 | if( s_version <= 37) |
| 9409 | { | ||
| 9410 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 71655 times.
|
71936 | if(tempitem.type == itype_flippers) |
| 9411 | { | ||
| 9412 |
2/2✓ Branch 0 taken 79 times.
✓ Branch 1 taken 202 times.
|
281 | if ( (get_qr(qr_NODIVING)) ) tempitem.flags |= item_flag1; |
| 9413 | 202 | else tempitem.flags &= ~ item_flag1; | |
| 9414 | 281 | } | |
| 9415 |
2/2✓ Branch 0 taken 54245 times.
✓ Branch 1 taken 17410 times.
|
71655 | else if(tempitem.type == itype_sword) |
| 9416 | { | ||
| 9417 |
2/2✓ Branch 0 taken 438 times.
✓ Branch 1 taken 16972 times.
|
17410 | if ( (get_qr(qr_QUICKSWORD)) ) tempitem.flags |= item_flag5; |
| 9418 | 16972 | else tempitem.flags &= ~ item_flag5; | |
| 9419 | 17410 | } | |
| 9420 |
2/2✓ Branch 0 taken 296 times.
✓ Branch 1 taken 53949 times.
|
54245 | else if(tempitem.type == itype_wand) |
| 9421 | { | ||
| 9422 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 287 times.
|
296 | if ( (get_qr(qr_QUICKSWORD)) ) tempitem.flags |= item_flag5; |
| 9423 | 287 | else tempitem.flags &= ~ item_flag5; | |
| 9424 | 296 | } | |
| 9425 |
4/4✓ Branch 0 taken 53655 times.
✓ Branch 1 taken 294 times.
✓ Branch 2 taken 598 times.
✓ Branch 3 taken 53057 times.
|
53949 | else if(tempitem.type == itype_book || tempitem.type == itype_candle) |
| 9426 | { | ||
| 9427 | //@Emily: What was qrFIREPROOFHERO2 again, and does that also need to enable this? | ||
| 9428 |
2/2✓ Branch 0 taken 375 times.
✓ Branch 1 taken 517 times.
|
892 | if ( (get_qr(qr_FIREPROOFHERO)) ) tempitem.flags |= item_flag3; |
| 9429 | 517 | else tempitem.flags &= ~ item_flag3; | |
| 9430 | 892 | } | |
| 9431 | 71936 | } | |
| 9432 | |||
| 9433 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 71936 times.
|
126976 | if( s_version < 38) |
| 9434 | { | ||
| 9435 |
4/4✓ Branch 0 taken 71095 times.
✓ Branch 1 taken 841 times.
✓ Branch 2 taken 558 times.
✓ Branch 3 taken 70537 times.
|
71936 | if(tempitem.type == itype_brang || tempitem.type == itype_hookshot) |
| 9436 | { | ||
| 9437 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1399 times.
|
1399 | if(get_qr(qr_BRANGPICKUP)) tempitem.flags |= item_flag4; |
| 9438 | 1399 | else tempitem.flags &= ~item_flag4; | |
| 9439 | |||
| 9440 |
2/2✓ Branch 0 taken 673 times.
✓ Branch 1 taken 726 times.
|
1399 | if(get_qr(qr_Z3BRANG_HSHOT)) tempitem.flags |= item_flag5 | item_flag6; |
| 9441 | 726 | else tempitem.flags &= ~(item_flag5|item_flag6); | |
| 9442 | 1399 | } | |
| 9443 |
2/2✓ Branch 0 taken 69709 times.
✓ Branch 1 taken 828 times.
|
70537 | else if(tempitem.type == itype_arrow) |
| 9444 | { | ||
| 9445 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 828 times.
|
828 | if(get_qr(qr_BRANGPICKUP)) tempitem.flags |= item_flag4; |
| 9446 | 828 | else tempitem.flags &= ~item_flag4; | |
| 9447 | |||
| 9448 |
2/2✓ Branch 0 taken 396 times.
✓ Branch 1 taken 432 times.
|
828 | if(get_qr(qr_Z3BRANG_HSHOT)) tempitem.flags &= ~item_flag2; |
| 9449 | 432 | else tempitem.flags |= item_flag2; | |
| 9450 | 828 | } | |
| 9451 | 71936 | } | |
| 9452 | |||
| 9453 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 71936 times.
|
126976 | if( s_version < 39) |
| 9454 | { | ||
| 9455 |
6/6✓ Branch 0 taken 71658 times.
✓ Branch 1 taken 278 times.
✓ Branch 2 taken 71364 times.
✓ Branch 3 taken 294 times.
✓ Branch 4 taken 598 times.
✓ Branch 5 taken 70766 times.
|
71936 | if(tempitem.type == itype_divinefire || tempitem.type == itype_book || tempitem.type == itype_candle) |
| 9456 | { | ||
| 9457 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 1154 times.
|
1170 | if(get_qr(qr_TEMPCANDLELIGHT)) tempitem.flags |= item_flag5; |
| 9458 | 1154 | else tempitem.flags &= ~item_flag5; | |
| 9459 | 1170 | } | |
| 9460 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 70154 times.
|
70766 | else if(tempitem.type == itype_potion) |
| 9461 | { | ||
| 9462 |
2/2✓ Branch 0 taken 160 times.
✓ Branch 1 taken 452 times.
|
612 | if(get_qr(qr_NONBUBBLEMEDICINE)) |
| 9463 | { | ||
| 9464 | 160 | tempitem.flags &= ~(item_flag3|item_flag4); | |
| 9465 | 160 | } | |
| 9466 | else | ||
| 9467 | { | ||
| 9468 | 452 | tempitem.flags |= item_flag3; | |
| 9469 |
2/2✓ Branch 0 taken 119 times.
✓ Branch 1 taken 333 times.
|
452 | if(get_qr(qr_ITEMBUBBLE))tempitem.flags |= item_flag4; |
| 9470 | 333 | else tempitem.flags &= ~item_flag4; | |
| 9471 | } | ||
| 9472 | 612 | } | |
| 9473 |
2/2✓ Branch 0 taken 69598 times.
✓ Branch 1 taken 556 times.
|
70154 | else if(tempitem.type == itype_triforcepiece) |
| 9474 | { | ||
| 9475 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 474 times.
|
556 | if(get_qr(qr_NONBUBBLETRIFORCE)) |
| 9476 | { | ||
| 9477 | 82 | tempitem.flags |= item_flag3; | |
| 9478 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 26 times.
|
82 | if(get_qr(qr_ITEMBUBBLE))tempitem.flags |= item_flag4; |
| 9479 | 26 | else tempitem.flags &= ~item_flag4; | |
| 9480 | 82 | } | |
| 9481 | else | ||
| 9482 | { | ||
| 9483 | 474 | tempitem.flags &= ~(item_flag3|item_flag4); | |
| 9484 | } | ||
| 9485 | 556 | } | |
| 9486 | 71936 | } | |
| 9487 | |||
| 9488 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 71936 times.
|
126976 | if( s_version < 40) |
| 9489 | { | ||
| 9490 |
4/4✓ Branch 0 taken 71022 times.
✓ Branch 1 taken 914 times.
✓ Branch 2 taken 305 times.
✓ Branch 3 taken 70717 times.
|
71936 | if(tempitem.type == itype_ring || tempitem.type == itype_perilring) |
| 9491 | { | ||
| 9492 |
2/2✓ Branch 0 taken 289 times.
✓ Branch 1 taken 930 times.
|
1219 | if(get_qr(qr_RINGAFFECTDAMAGE))tempitem.flags |= item_flag1; |
| 9493 | 930 | else tempitem.flags &= ~item_flag1; | |
| 9494 | 1219 | } | |
| 9495 |
8/8✓ Branch 0 taken 70119 times.
✓ Branch 1 taken 598 times.
✓ Branch 2 taken 52709 times.
✓ Branch 3 taken 17410 times.
✓ Branch 4 taken 52413 times.
✓ Branch 5 taken 296 times.
✓ Branch 6 taken 278 times.
✓ Branch 7 taken 52135 times.
|
70717 | else if(tempitem.type == itype_candle || tempitem.type == itype_sword || tempitem.type == itype_wand || tempitem.type == itype_cbyrna) |
| 9496 | { | ||
| 9497 |
2/2✓ Branch 0 taken 108 times.
✓ Branch 1 taken 18474 times.
|
18582 | if(get_qr(qr_SLASHFLIPFIX))tempitem.flags |= item_flag8; |
| 9498 | 18474 | else tempitem.flags &= ~item_flag8; | |
| 9499 | 18582 | } | |
| 9500 |
6/6✓ Branch 0 taken 54526 times.
✓ Branch 1 taken 17410 times.
✓ Branch 2 taken 54230 times.
✓ Branch 3 taken 296 times.
✓ Branch 4 taken 281 times.
✓ Branch 5 taken 53949 times.
|
71936 | if(tempitem.type == itype_sword || tempitem.type == itype_wand || tempitem.type == itype_hammer) |
| 9501 | { | ||
| 9502 |
2/2✓ Branch 0 taken 78 times.
✓ Branch 1 taken 17909 times.
|
17987 | if(get_qr(qr_NOITEMMELEE))tempitem.flags |= item_flag7; |
| 9503 | 17909 | else tempitem.flags &= ~item_flag7; | |
| 9504 | 17987 | } | |
| 9505 |
2/2✓ Branch 0 taken 53671 times.
✓ Branch 1 taken 278 times.
|
53949 | else if(tempitem.type == itype_cbyrna) |
| 9506 | { | ||
| 9507 | 278 | tempitem.flags |= item_flag7; | |
| 9508 | 278 | } | |
| 9509 | 71936 | } | |
| 9510 | |||
| 9511 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 71936 times.
|
126976 | if( s_version < 41 ) |
| 9512 | { | ||
| 9513 |
2/2✓ Branch 0 taken 54526 times.
✓ Branch 1 taken 17410 times.
|
71936 | if(tempitem.type == itype_sword) |
| 9514 | { | ||
| 9515 |
2/2✓ Branch 0 taken 236 times.
✓ Branch 1 taken 17174 times.
|
17410 | if(get_qr(qr_SWORDMIRROR))tempitem.flags |= item_flag9; |
| 9516 | 17174 | else tempitem.flags &= ~item_flag9; | |
| 9517 | |||
| 9518 |
2/2✓ Branch 0 taken 428 times.
✓ Branch 1 taken 16982 times.
|
17410 | if(get_qr(qr_SLOWCHARGINGWALK))tempitem.flags |= item_flag10; |
| 9519 | 16982 | else tempitem.flags &= ~item_flag10; | |
| 9520 | 17410 | } | |
| 9521 | 71936 | } | |
| 9522 | |||
| 9523 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 71936 times.
|
126976 | if( s_version < 42 ) |
| 9524 | { | ||
| 9525 |
2/2✓ Branch 0 taken 296 times.
✓ Branch 1 taken 71640 times.
|
71936 | if(tempitem.type == itype_wand) |
| 9526 | { | ||
| 9527 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 278 times.
|
296 | if(get_qr(qr_NOWANDMELEE))tempitem.flags |= item_flag3; |
| 9528 | 278 | else tempitem.flags &= ~item_flag3; | |
| 9529 | |||
| 9530 | 296 | tempitem.flags &= ~item_flag6; | |
| 9531 | 296 | } | |
| 9532 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 71359 times.
|
71640 | else if(tempitem.type == itype_hammer) |
| 9533 | { | ||
| 9534 | 281 | tempitem.flags &= ~item_flag3; | |
| 9535 | 281 | } | |
| 9536 |
2/2✓ Branch 0 taken 278 times.
✓ Branch 1 taken 71081 times.
|
71359 | else if(tempitem.type == itype_cbyrna) |
| 9537 | { | ||
| 9538 | 278 | tempitem.flags |= item_flag3; | |
| 9539 | |||
| 9540 | 278 | tempitem.flags &= ~item_flag6; | |
| 9541 | 278 | } | |
| 9542 |
2/2✓ Branch 0 taken 53671 times.
✓ Branch 1 taken 17410 times.
|
71081 | else if(tempitem.type == itype_sword) |
| 9543 | { | ||
| 9544 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17410 times.
|
17410 | if(get_qr(qr_MELEEMAGICCOST))tempitem.flags |= item_flag6; |
| 9545 | 17410 | else tempitem.flags &= ~item_flag6; | |
| 9546 | 17410 | } | |
| 9547 | 71936 | } | |
| 9548 | |||
| 9549 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 71936 times.
|
126976 | if( s_version < 43 ) |
| 9550 | { | ||
| 9551 |
2/2✓ Branch 0 taken 71610 times.
✓ Branch 1 taken 326 times.
|
71936 | if(tempitem.type == itype_whistle) |
| 9552 | { | ||
| 9553 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 316 times.
|
326 | if(get_qr(qr_WHIRLWINDMIRROR))tempitem.flags |= item_flag3; |
| 9554 | 316 | else tempitem.flags &= ~item_flag3; | |
| 9555 | 326 | } | |
| 9556 | 71936 | } | |
| 9557 | |||
| 9558 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 71936 times.
|
126976 | if( s_version < 45 ) |
| 9559 | { | ||
| 9560 |
2/2✓ Branch 0 taken 71655 times.
✓ Branch 1 taken 281 times.
|
71936 | if(tempitem.type == itype_flippers) |
| 9561 | { | ||
| 9562 | 281 | tempitem.misc1 = 50; //Dive length, default 50 frames -V | |
| 9563 | 281 | tempitem.misc2 = 30; //Dive cooldown, default 30 frames -V | |
| 9564 | 281 | } | |
| 9565 | 71936 | } | |
| 9566 | |||
| 9567 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 71936 times.
|
126976 | if( s_version < 46 ) |
| 9568 | { | ||
| 9569 |
2/2✓ Branch 0 taken 71658 times.
✓ Branch 1 taken 278 times.
|
71936 | if(tempitem.type == itype_raft) |
| 9570 | { | ||
| 9571 | 278 | tempitem.misc1 = 1; //Rafting speed modifier; default 1. Negative slows, positive speeds. | |
| 9572 | 278 | } | |
| 9573 | 71936 | } | |
| 9574 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 71936 times.
|
126976 | if ( s_version < 34 ) //! set the default counter for older quests. |
| 9575 | { | ||
| 9576 |
2/2✓ Branch 0 taken 116 times.
✓ Branch 1 taken 71820 times.
|
71936 | if ( (tempitem.flags & item_rupee_magic) ) |
| 9577 | { | ||
| 9578 | 116 | tempitem.cost_counter[0] = 1; | |
| 9579 | 116 | } | |
| 9580 | else | ||
| 9581 | { | ||
| 9582 |
2/2✓ Branch 0 taken 42240 times.
✓ Branch 1 taken 29580 times.
|
71820 | if(get_qr(qr_ENABLEMAGIC)) |
| 9583 | 42240 | tempitem.cost_counter[0] = 4; | |
| 9584 | else | ||
| 9585 | { | ||
| 9586 | 29580 | tempitem.cost_amount[0] = 0; | |
| 9587 | 29580 | tempitem.cost_counter[0] = -1; | |
| 9588 | } | ||
| 9589 | } | ||
| 9590 | 71936 | } | |
| 9591 | |||
| 9592 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 71936 times.
|
126976 | if ( s_version < 35 ) //new Lens of Truth flags |
| 9593 | { | ||
| 9594 |
2/2✓ Branch 0 taken 71682 times.
✓ Branch 1 taken 254 times.
|
71936 | if ( tempitem.type == itype_lens ) |
| 9595 | { | ||
| 9596 |
2/2✓ Branch 0 taken 244 times.
✓ Branch 1 taken 10 times.
|
254 | if ( get_qr(qr_RAFTLENS) ) |
| 9597 | { | ||
| 9598 | 10 | tempitem.flags |= item_flag4; | |
| 9599 | 10 | } | |
| 9600 |
2/2✓ Branch 0 taken 89 times.
✓ Branch 1 taken 165 times.
|
254 | if ( get_qr(qr_LENSHINTS) ) |
| 9601 | { | ||
| 9602 | 165 | tempitem.flags |= item_flag1; | |
| 9603 | 165 | } | |
| 9604 |
2/2✓ Branch 0 taken 241 times.
✓ Branch 1 taken 13 times.
|
254 | if ( get_qr(qr_LENSSEESENEMIES) ) |
| 9605 | { | ||
| 9606 | 13 | tempitem.flags |= item_flag5; | |
| 9607 | 13 | } | |
| 9608 | 254 | } | |
| 9609 | 71936 | } | |
| 9610 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 71936 times.
|
126976 | if ( s_version < 44 ) //InitD Labels and Sprite Script Data |
| 9611 | { | ||
| 9612 |
2/2✓ Branch 0 taken 575488 times.
✓ Branch 1 taken 71936 times.
|
647424 | for ( int32_t q = 0; q < 8; q++ ) |
| 9613 | { | ||
| 9614 | 575488 | sprintf(tempitem.initD_label[q],"InitD[%d]",q); | |
| 9615 | 575488 | sprintf(tempitem.sprite_initD_label[q],"InitD[%d]",q); | |
| 9616 | 575488 | tempitem.sprite_initiald[q] = 0; | |
| 9617 | 575488 | } | |
| 9618 | 71936 | tempitem.sprite_script = 0; | |
| 9619 | 71936 | } | |
| 9620 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 71936 times.
|
126976 | if ( s_version < 47 ) //InitD Labels and Sprite Script Data |
| 9621 | { | ||
| 9622 | 71936 | tempitem.pickupflag = 0; | |
| 9623 | 71936 | } | |
| 9624 | |||
| 9625 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 71936 times.
|
126976 | if( s_version < 51 ) |
| 9626 | { | ||
| 9627 |
2/2✓ Branch 0 taken 71338 times.
✓ Branch 1 taken 598 times.
|
71936 | if( tempitem.type == itype_candle ) |
| 9628 | { | ||
| 9629 | 598 | tempitem.misc4 = 50; //Step speed | |
| 9630 | 598 | } | |
| 9631 | 71936 | } | |
| 9632 | |||
| 9633 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 71936 times.
|
126976 | if( s_version < 52 ) |
| 9634 | { | ||
| 9635 |
2/2✓ Branch 0 taken 71081 times.
✓ Branch 1 taken 855 times.
|
71936 | if( tempitem.type == itype_shield ) |
| 9636 | 855 | tempitem.flags |= item_flag1; //'Block Front' flag | |
| 9637 | 71936 | } | |
| 9638 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 71936 times.
|
126976 | if(s_version < 53) |
| 9639 | { | ||
| 9640 |
4/4✓ Branch 0 taken 294 times.
✓ Branch 1 taken 70534 times.
✓ Branch 2 taken 828 times.
✓ Branch 3 taken 280 times.
|
71936 | switch(tempitem.type) |
| 9641 | { | ||
| 9642 | case itype_arrow: | ||
| 9643 | 828 | tempitem.cost_counter[1] = crARROWS; | |
| 9644 | 828 | tempitem.cost_amount[1] = 1; | |
| 9645 | 828 | break; | |
| 9646 | case itype_bomb: | ||
| 9647 | 294 | tempitem.cost_counter[1] = crBOMBS; | |
| 9648 | 294 | tempitem.cost_amount[1] = 1; | |
| 9649 | 294 | break; | |
| 9650 | case itype_sbomb: | ||
| 9651 | 280 | tempitem.cost_counter[1] = crSBOMBS; | |
| 9652 | 280 | tempitem.cost_amount[1] = 1; | |
| 9653 | 280 | break; | |
| 9654 | default: | ||
| 9655 | 70534 | tempitem.cost_counter[1] = crNONE; | |
| 9656 | 70534 | tempitem.cost_amount[1] = 0; | |
| 9657 | 70534 | } | |
| 9658 | 71936 | tempitem.magiccosttimer[1] = 0; | |
| 9659 | 71936 | } | |
| 9660 |
2/2✓ Branch 0 taken 52224 times.
✓ Branch 1 taken 74752 times.
|
126976 | if( s_version < 54 ) |
| 9661 | { | ||
| 9662 |
2/2✓ Branch 0 taken 74458 times.
✓ Branch 1 taken 294 times.
|
74752 | if( tempitem.type == itype_flippers ) |
| 9663 | 294 | tempitem.misc3 = INT_BTN_A; //'Block Front' flag | |
| 9664 | 74752 | } | |
| 9665 |
2/2✓ Branch 0 taken 52224 times.
✓ Branch 1 taken 74752 times.
|
126976 | if(s_version < 55) |
| 9666 | { | ||
| 9667 |
3/3✓ Branch 0 taken 578 times.
✓ Branch 1 taken 578 times.
✓ Branch 2 taken 73596 times.
|
74752 | switch(tempitem.type) |
| 9668 | { | ||
| 9669 | case itype_spinscroll: | ||
| 9670 | case itype_quakescroll: | ||
| 9671 | 578 | tempitem.usesound2 = WAV_ZN1CHARGE; | |
| 9672 | 578 | break; | |
| 9673 | case itype_spinscroll2: | ||
| 9674 | case itype_quakescroll2: | ||
| 9675 | 578 | tempitem.usesound2 = WAV_ZN1CHARGE2; | |
| 9676 | 578 | break; | |
| 9677 | } | ||
| 9678 | 74752 | } | |
| 9679 |
2/2✓ Branch 0 taken 52224 times.
✓ Branch 1 taken 74752 times.
|
126976 | if(s_version < 56) |
| 9680 | { | ||
| 9681 |
4/4✓ Branch 0 taken 73534 times.
✓ Branch 1 taken 289 times.
✓ Branch 2 taken 624 times.
✓ Branch 3 taken 305 times.
|
74752 | switch(tempitem.type) |
| 9682 | { | ||
| 9683 | case itype_divinefire: | ||
| 9684 |
2/2✓ Branch 0 taken 278 times.
✓ Branch 1 taken 11 times.
|
289 | SETFLAG(tempitem.flags, item_flag9, version < 0x255); //Strong Fire |
| 9685 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 208 times.
|
289 | SETFLAG(tempitem.flags, item_flag10, version < 0x250); //Magic Fire |
| 9686 | 289 | tempitem.flags |= item_flag11; //Divine Fire | |
| 9687 | 289 | break; | |
| 9688 | case itype_candle: | ||
| 9689 |
2/2✓ Branch 0 taken 311 times.
✓ Branch 1 taken 313 times.
|
624 | SETFLAG(tempitem.flags, item_flag9, tempitem.level > 1); //Strong Fire |
| 9690 | 624 | tempitem.flags &= ~item_flag10; //Magic Fire | |
| 9691 | 624 | tempitem.flags &= ~item_flag11; //Divine Fire | |
| 9692 | 624 | break; | |
| 9693 | case itype_book: | ||
| 9694 | 305 | tempitem.flags |= item_flag9; //Strong Fire | |
| 9695 | 305 | tempitem.flags |= item_flag10; //Magic Fire | |
| 9696 | 305 | tempitem.flags &= ~item_flag11; //Divine Fire | |
| 9697 | 305 | break; | |
| 9698 | } | ||
| 9699 | 74752 | } | |
| 9700 |
2/2✓ Branch 0 taken 43264 times.
✓ Branch 1 taken 83712 times.
|
126976 | if (s_version < 61) |
| 9701 | { | ||
| 9702 |
2/2✓ Branch 0 taken 65447 times.
✓ Branch 1 taken 18265 times.
|
83712 | switch (tempitem.type) |
| 9703 | { | ||
| 9704 | case itype_sword: | ||
| 9705 | 18265 | tempitem.usesound2 = WAV_BEAM; | |
| 9706 | 18265 | break; | |
| 9707 | } | ||
| 9708 | 83712 | } | |
| 9709 | |||
| 9710 | |||
| 9711 |
2/2✓ Branch 0 taken 10854 times.
✓ Branch 1 taken 116122 times.
|
126976 | if(tempitem.level==0) // Always do this |
| 9712 | 10854 | tempitem.level=1; | |
| 9713 | |||
| 9714 | 126976 | itemsbuf[i] = tempitem; | |
| 9715 | 126976 | } | |
| 9716 | |||
| 9717 | 496 | return 0; | |
| 9718 | 497 | } | |
| 9719 | |||
| 9720 | static bool did_init_def_items = false; | ||
| 9721 | 253899 | void init_def_items() | |
| 9722 | { | ||
| 9723 |
2/2✓ Branch 0 taken 253517 times.
✓ Branch 1 taken 382 times.
|
253899 | if(did_init_def_items) return; |
| 9724 | 382 | did_init_def_items = true; | |
| 9725 | 382 | default_items[3].cost_counter[1] = crBOMBS; | |
| 9726 | 382 | default_items[13].cost_counter[1] = crARROWS; | |
| 9727 | 382 | default_items[14].cost_counter[1] = crARROWS; | |
| 9728 | 382 | default_items[48].cost_counter[1] = crSBOMBS; | |
| 9729 | 382 | default_items[57].cost_counter[1] = crARROWS; | |
| 9730 | 253899 | } | |
| 9731 | 253899 | void reset_itembuf(itemdata *item, int32_t id) | |
| 9732 | { | ||
| 9733 | 253899 | init_def_items(); | |
| 9734 |
2/2✓ Branch 0 taken 106898 times.
✓ Branch 1 taken 147001 times.
|
253899 | if(id<iLast) |
| 9735 | { | ||
| 9736 | // Copy everything *EXCEPT* the tile, misc, cset, frames, speed, delay and ltm. | ||
| 9737 | 147001 | word tile = item->tile; | |
| 9738 | 147001 | byte miscs = item->misc_flags, cset = item->csets, frames = item->frames, speed = item->speed, delay = item->delay; | |
| 9739 | 147001 | int32_t ltm = item->ltm; | |
| 9740 | |||
| 9741 | 147001 | *item = default_items[id]; | |
| 9742 | 147001 | item->tile = tile; | |
| 9743 | 147001 | item->misc_flags = miscs; | |
| 9744 | 147001 | item->csets = cset; | |
| 9745 | 147001 | item->frames = frames; | |
| 9746 | 147001 | item->speed = speed; | |
| 9747 | 147001 | item->delay = delay; | |
| 9748 | 147001 | item->ltm = ltm; | |
| 9749 | 147001 | } | |
| 9750 | 253899 | } | |
| 9751 | |||
| 9752 | 103936 | void reset_itemname(int32_t id) | |
| 9753 | { | ||
| 9754 | 103936 | sprintf(item_string[id],"zz%03d",id); | |
| 9755 | |||
| 9756 |
2/2✓ Branch 0 taken 45878 times.
✓ Branch 1 taken 58058 times.
|
103936 | if(id < iLast) |
| 9757 | 58058 | strcpy(item_string[id],old_item_string[id]); | |
| 9758 | 103936 | } | |
| 9759 | |||
| 9760 | 497 | int32_t readweapons(PACKFILE *f, zquestheader *Header) | |
| 9761 | { | ||
| 9762 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 24 times.
|
497 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_weapons); |
| 9763 | |||
| 9764 | 497 | word weapons_to_read=MAXWPNS; | |
| 9765 | int32_t dummy; | ||
| 9766 | byte padding; | ||
| 9767 | wpndata tempweapon; | ||
| 9768 | 497 | word s_version=0; | |
| 9769 | |||
| 9770 | |||
| 9771 |
2/2✓ Branch 0 taken 491 times.
✓ Branch 1 taken 6 times.
|
497 | if(Header->zelda_version < 0x186) |
| 9772 | { | ||
| 9773 | 6 | weapons_to_read=64; | |
| 9774 | 6 | } | |
| 9775 | |||
| 9776 |
2/2✓ Branch 0 taken 491 times.
✓ Branch 1 taken 6 times.
|
497 | if(Header->zelda_version < 0x185) |
| 9777 | { | ||
| 9778 | 6 | weapons_to_read=32; | |
| 9779 | 6 | } | |
| 9780 | |||
| 9781 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 473 times.
|
497 | if(Header->zelda_version > 0x192) |
| 9782 | { | ||
| 9783 | 473 | weapons_to_read=0; | |
| 9784 | |||
| 9785 | //section version info | ||
| 9786 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetw(&s_version,f)) |
| 9787 | { | ||
| 9788 | ✗ | return qe_invalid; | |
| 9789 | } | ||
| 9790 | |||
| 9791 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if (s_version > V_WEAPONS) |
| 9792 | ✗ | return qe_version; | |
| 9793 | |||
| 9794 | 473 | FFCore.quest_format[vWeaponSprites] = s_version; | |
| 9795 | |||
| 9796 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!read_deprecated_section_cversion(f)) |
| 9797 | { | ||
| 9798 | ✗ | return qe_invalid; | |
| 9799 | } | ||
| 9800 | |||
| 9801 | //section size | ||
| 9802 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetl(&dummy,f)) |
| 9803 | { | ||
| 9804 | ✗ | return qe_invalid; | |
| 9805 | } | ||
| 9806 | |||
| 9807 | //finally... section data | ||
| 9808 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetw(&weapons_to_read,f)) |
| 9809 | { | ||
| 9810 | ✗ | return qe_invalid; | |
| 9811 | } | ||
| 9812 | |||
| 9813 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if (weapons_to_read > MAXWPNS) |
| 9814 | { | ||
| 9815 | ✗ | return qe_invalid; | |
| 9816 | } | ||
| 9817 | 473 | } | |
| 9818 | |||
| 9819 |
2/2✓ Branch 0 taken 415 times.
✓ Branch 1 taken 82 times.
|
497 | if(s_version>2) |
| 9820 | { | ||
| 9821 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 415 times.
|
106655 | for(int32_t i=0; i<weapons_to_read; i++) |
| 9822 | { | ||
| 9823 | char tempname[64]; | ||
| 9824 | |||
| 9825 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if(!pfread(tempname, 64, f)) |
| 9826 | { | ||
| 9827 | ✗ | return qe_invalid; | |
| 9828 | } | ||
| 9829 | |||
| 9830 | 106240 | weapon_string[i][0] = '\0'; | |
| 9831 | 106240 | strncat(weapon_string[i], tempname, 64 - 1); | |
| 9832 | 106240 | } | |
| 9833 | |||
| 9834 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(s_version<4) |
| 9835 | { | ||
| 9836 | ✗ | strcpy(weapon_string[iwHover],old_weapon_string[iwHover]); | |
| 9837 | ✗ | strcpy(weapon_string[wFIREMAGIC],old_weapon_string[wFIREMAGIC]); | |
| 9838 | ✗ | } | |
| 9839 | |||
| 9840 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(s_version<5) |
| 9841 | { | ||
| 9842 | ✗ | strcpy(weapon_string[iwQuarterHearts],old_weapon_string[iwQuarterHearts]); | |
| 9843 | ✗ | } | |
| 9844 | |||
| 9845 | /* | ||
| 9846 | if (s_version<6) | ||
| 9847 | { | ||
| 9848 | strcpy(weapon_string[iwSideRaft],old_weapon_string[iwSideRaft]); | ||
| 9849 | strcpy(weapon_string[iwSideLadder],old_weapon_string[iwSideLadder]); | ||
| 9850 | } | ||
| 9851 | */ | ||
| 9852 | 415 | } | |
| 9853 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 81 times.
|
82 | else if (!should_skip) |
| 9854 | { | ||
| 9855 |
2/2✓ Branch 0 taken 20736 times.
✓ Branch 1 taken 81 times.
|
20817 | for(int32_t i=0; i<MAXWPNS; i++) |
| 9856 | 20736 | reset_weaponname(i); | |
| 9857 | 81 | } | |
| 9858 | |||
| 9859 |
2/2✓ Branch 0 taken 114984 times.
✓ Branch 1 taken 497 times.
|
115481 | for(int32_t i=0; i<weapons_to_read; i++) |
| 9860 | { | ||
| 9861 | 114984 | word oldtile = 0; | |
| 9862 |
2/2✓ Branch 0 taken 53760 times.
✓ Branch 1 taken 61224 times.
|
114984 | if (s_version < 8) |
| 9863 | { | ||
| 9864 |
1/2✓ Branch 0 taken 61224 times.
✗ Branch 1 not taken.
|
61224 | if (!p_igetw(&oldtile, f)) |
| 9865 | ✗ | return qe_invalid; | |
| 9866 | 61224 | } | |
| 9867 | |||
| 9868 |
1/2✓ Branch 0 taken 114984 times.
✗ Branch 1 not taken.
|
114984 | if(!p_getc(&tempweapon.misc,f)) |
| 9869 | { | ||
| 9870 | ✗ | return qe_invalid; | |
| 9871 | } | ||
| 9872 | |||
| 9873 |
1/2✓ Branch 0 taken 114984 times.
✗ Branch 1 not taken.
|
114984 | if(!p_getc(&tempweapon.csets,f)) |
| 9874 | { | ||
| 9875 | ✗ | return qe_invalid; | |
| 9876 | } | ||
| 9877 | |||
| 9878 |
1/2✓ Branch 0 taken 114984 times.
✗ Branch 1 not taken.
|
114984 | if(!p_getc(&tempweapon.frames,f)) |
| 9879 | { | ||
| 9880 | ✗ | return qe_invalid; | |
| 9881 | } | ||
| 9882 | |||
| 9883 |
1/2✓ Branch 0 taken 114984 times.
✗ Branch 1 not taken.
|
114984 | if(!p_getc(&tempweapon.speed,f)) |
| 9884 | { | ||
| 9885 | ✗ | return qe_invalid; | |
| 9886 | } | ||
| 9887 | |||
| 9888 |
1/2✓ Branch 0 taken 114984 times.
✗ Branch 1 not taken.
|
114984 | if(!p_getc(&tempweapon.type,f)) |
| 9889 | { | ||
| 9890 | ✗ | return qe_invalid; | |
| 9891 | } | ||
| 9892 | |||
| 9893 |
2/2✓ Branch 0 taken 59944 times.
✓ Branch 1 taken 55040 times.
|
114984 | if ( s_version >= 7 ) |
| 9894 | { | ||
| 9895 |
1/2✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
|
55040 | if(!p_igetw(&tempweapon.script,f)) |
| 9896 | { | ||
| 9897 | ✗ | return qe_invalid; | |
| 9898 | } | ||
| 9899 |
1/2✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
|
55040 | if(!p_igetl(&tempweapon.tile,f)) |
| 9900 | { | ||
| 9901 | ✗ | return qe_invalid; | |
| 9902 | } | ||
| 9903 | 55040 | } | |
| 9904 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 59944 times.
|
114984 | if ( s_version < 7 ) |
| 9905 | { | ||
| 9906 | 59944 | tempweapon.tile = oldtile; | |
| 9907 | 59944 | } | |
| 9908 | |||
| 9909 |
2/2✓ Branch 0 taken 110184 times.
✓ Branch 1 taken 4800 times.
|
114984 | if(Header->zelda_version < 0x193) |
| 9910 | { | ||
| 9911 |
1/2✓ Branch 0 taken 4800 times.
✗ Branch 1 not taken.
|
4800 | if(!p_getc(&padding,f)) |
| 9912 | { | ||
| 9913 | ✗ | return qe_invalid; | |
| 9914 | } | ||
| 9915 | 4800 | } | |
| 9916 | |||
| 9917 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 8744 times.
|
114984 | if(s_version < 6) |
| 9918 | { | ||
| 9919 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 8726 times.
|
8744 | if(i==ewFIRETRAIL) |
| 9920 | { | ||
| 9921 | 18 | tempweapon.misc |= WF_BEHIND; | |
| 9922 | 18 | } | |
| 9923 | else | ||
| 9924 | 8726 | tempweapon.misc &= ~WF_BEHIND; | |
| 9925 | 8744 | } | |
| 9926 | |||
| 9927 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 114728 times.
|
114984 | if (!should_skip) |
| 9928 | 114728 | memcpy(&wpnsbuf[i], &tempweapon, sizeof(tempweapon)); | |
| 9929 | 114984 | } | |
| 9930 | |||
| 9931 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 496 times.
|
497 | if (should_skip) |
| 9932 | 1 | return 0; | |
| 9933 | |||
| 9934 |
2/2✓ Branch 0 taken 415 times.
✓ Branch 1 taken 81 times.
|
496 | if(s_version<2) |
| 9935 | { | ||
| 9936 | 81 | wpnsbuf[wSBOOM]=wpnsbuf[wBOOM]; | |
| 9937 | 81 | } | |
| 9938 | |||
| 9939 |
2/2✓ Branch 0 taken 415 times.
✓ Branch 1 taken 81 times.
|
496 | if(s_version<5) |
| 9940 | { | ||
| 9941 | 81 | wpnsbuf[iwQuarterHearts].tile=1; | |
| 9942 | 81 | wpnsbuf[iwQuarterHearts].csets=1; | |
| 9943 | 81 | } | |
| 9944 | |||
| 9945 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | if(Header->zelda_version < 0x176) |
| 9946 | { | ||
| 9947 | ✗ | wpnsbuf[iwSpawn] = *((wpndata*)(itemsbuf + iMisc1)); | |
| 9948 | ✗ | wpnsbuf[iwDeath] = *((wpndata*)(itemsbuf + iMisc2)); | |
| 9949 | ✗ | itemsbuf[iMisc1].clear(); | |
| 9950 | ✗ | itemsbuf[iMisc2].clear(); | |
| 9951 | ✗ | } | |
| 9952 | |||
| 9953 |
3/4✓ Branch 0 taken 478 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
|
501 | if((Header->zelda_version < 0x192)|| |
| 9954 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 473 times.
|
478 | ((Header->zelda_version == 0x192)&&(Header->build<129))) |
| 9955 | { | ||
| 9956 | 18 | wpnsbuf[wHSCHAIN_V] = wpnsbuf[wHSCHAIN_H]; | |
| 9957 | 18 | } | |
| 9958 | |||
| 9959 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 23 times.
|
496 | if((Header->zelda_version < 0x210)) |
| 9960 | { | ||
| 9961 | 23 | wpnsbuf[wLSHEAD] = wpnsbuf[wHSHEAD]; | |
| 9962 | 23 | wpnsbuf[wLSCHAIN_H] = wpnsbuf[wHSCHAIN_H]; | |
| 9963 | 23 | wpnsbuf[wLSHANDLE] = wpnsbuf[wHSHANDLE]; | |
| 9964 | 23 | wpnsbuf[wLSCHAIN_V] = wpnsbuf[wHSCHAIN_V]; | |
| 9965 | 23 | } | |
| 9966 | |||
| 9967 | 496 | return 0; | |
| 9968 | 497 | } | |
| 9969 | |||
| 9970 | 224774 | static void guy_update_firesfx(guydata& tempguy) | |
| 9971 | { | ||
| 9972 | 224774 | tempguy.firesfx = 0; | |
| 9973 |
2/2✓ Branch 0 taken 6551 times.
✓ Branch 1 taken 218223 times.
|
224774 | if (tempguy.type == eeWIZZ) |
| 9974 | { | ||
| 9975 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 988 times.
✓ Branch 2 taken 4005 times.
✓ Branch 3 taken 843 times.
✓ Branch 4 taken 715 times.
|
6551 | switch (tempguy.attributes[1]) |
| 9976 | { | ||
| 9977 | case 0: // normal weapon | ||
| 9978 | 4005 | tempguy.firesfx = WAV_WAND; | |
| 9979 | 4005 | break; | |
| 9980 | case 1: // 8 shots | ||
| 9981 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 762 times.
|
843 | if (get_qr(qr_8WAY_SHOT_SFX_DEP)) tempguy.firesfx = WAV_FIRE; |
| 9982 | else | ||
| 9983 | { | ||
| 9984 |
3/8✓ Branch 0 taken 658 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
✓ Branch 3 taken 16 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
762 | switch (tempguy.weapon) |
| 9985 | { | ||
| 9986 | case ewFireTrail: | ||
| 9987 | case ewFlame: | ||
| 9988 | case ewFlame2Trail: | ||
| 9989 | case ewFlame2: | ||
| 9990 | 658 | tempguy.firesfx = WAV_FIRE; | |
| 9991 | 658 | break; | |
| 9992 | case ewWind: | ||
| 9993 | case ewMagic: | ||
| 9994 | 88 | tempguy.firesfx = WAV_WAND; | |
| 9995 | 88 | break; | |
| 9996 | case ewIce: | ||
| 9997 | ✗ | tempguy.firesfx = WAV_ZN1ICE; | |
| 9998 | ✗ | break; | |
| 9999 | case ewRock: | ||
| 10000 | ✗ | tempguy.firesfx = WAV_ZN1ROCK; | |
| 10001 | ✗ | break; | |
| 10002 | case ewFireball2: | ||
| 10003 | case ewFireball: | ||
| 10004 | 16 | tempguy.firesfx = WAV_ZN1FIREBALL; | |
| 10005 | 16 | break; | |
| 10006 | case ewBrang: | ||
| 10007 | ✗ | tempguy.firesfx = WAV_BRANG; | |
| 10008 | ✗ | break; | |
| 10009 | case ewBomb:case ewSBomb: case ewLitBomb:case ewLitSBomb: | ||
| 10010 | ✗ | tempguy.firesfx = WAV_BOMB; | |
| 10011 | ✗ | break; | |
| 10012 | default: | ||
| 10013 | ✗ | tempguy.firesfx = 0; | |
| 10014 | ✗ | break; | |
| 10015 | } | ||
| 10016 | 762 | break; | |
| 10017 | } | ||
| 10018 | case 2: // Summon | ||
| 10019 | 1069 | tempguy.firesfx = WAV_FIRE; | |
| 10020 | 1069 | break; | |
| 10021 | case 3: // Summon Layer | ||
| 10022 | 715 | tempguy.firesfx = get_qr(qr_MORESOUNDS) ? WAV_ZN1SUMMON : WAV_FIRE; | |
| 10023 | 715 | break; | |
| 10024 | } | ||
| 10025 | 6551 | } | |
| 10026 | else | ||
| 10027 | { | ||
| 10028 |
6/6✓ Branch 0 taken 164447 times.
✓ Branch 1 taken 53776 times.
✓ Branch 2 taken 42742 times.
✓ Branch 3 taken 207189 times.
✓ Branch 4 taken 48261 times.
✓ Branch 5 taken 48257 times.
|
218223 | if ((tempguy.type == eeWALK || tempguy.type == eePROJECTILE) && (tempguy.attributes[0] == e1tSUMMON || tempguy.attributes[0] == e1tSUMMONLAYER)) |
| 10029 | { | ||
| 10030 | 96518 | tempguy.firesfx = get_qr(qr_MORESOUNDS) ? WAV_ZN1SUMMON : WAV_FIRE; | |
| 10031 | 96518 | } | |
| 10032 | else | ||
| 10033 | { | ||
| 10034 |
7/8✓ Branch 0 taken 9811 times.
✓ Branch 1 taken 2403 times.
✓ Branch 2 taken 1830 times.
✓ Branch 3 taken 13066 times.
✓ Branch 4 taken 173731 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4037 times.
✓ Branch 7 taken 2311 times.
|
207189 | switch (tempguy.weapon) |
| 10035 | { | ||
| 10036 | case ewFireTrail: | ||
| 10037 | case ewFlame: | ||
| 10038 | case ewFlame2Trail: | ||
| 10039 | case ewFlame2: | ||
| 10040 | 9811 | tempguy.firesfx = WAV_FIRE; | |
| 10041 | 9811 | break; | |
| 10042 | case ewWind: | ||
| 10043 | case ewMagic: | ||
| 10044 | 1830 | tempguy.firesfx = WAV_WAND; | |
| 10045 | 1830 | break; | |
| 10046 | case ewIce: | ||
| 10047 | ✗ | tempguy.firesfx = WAV_ZN1ICE; | |
| 10048 | ✗ | break; | |
| 10049 | case ewRock: | ||
| 10050 | 4037 | tempguy.firesfx = WAV_ZN1ROCK; | |
| 10051 | 4037 | break; | |
| 10052 | case ewFireball2: | ||
| 10053 | case ewFireball: | ||
| 10054 | 13066 | tempguy.firesfx = WAV_ZN1FIREBALL; | |
| 10055 | 13066 | break; | |
| 10056 | case ewBrang: | ||
| 10057 | 2311 | tempguy.firesfx = WAV_BRANG; | |
| 10058 | 2311 | break; | |
| 10059 | case ewBomb:case ewSBomb: case ewLitBomb:case ewLitSBomb: | ||
| 10060 | 2403 | tempguy.firesfx = WAV_BOMB; | |
| 10061 | 2403 | break; | |
| 10062 | default: | ||
| 10063 | 173731 | tempguy.firesfx = 0; | |
| 10064 | 173731 | break; | |
| 10065 | } | ||
| 10066 | } | ||
| 10067 | } | ||
| 10068 | 213744 | } | |
| 10069 | |||
| 10070 | 213744 | static void guy_update_weaponflags(guydata& tempguy) | |
| 10071 | { | ||
| 10072 | 213744 | tempguy.weap_data.unblockable = 0; | |
| 10073 | 213744 | tempguy.weap_data.moveflags = move_none; | |
| 10074 |
4/4✓ Branch 0 taken 207084 times.
✓ Branch 1 taken 6660 times.
✓ Branch 2 taken 3064 times.
✓ Branch 3 taken 204020 times.
|
213744 | if (tempguy.weapon == ewFlame || tempguy.weapon == ewFireTrail) |
| 10075 | 9724 | tempguy.weap_data.moveflags |= (move_obeys_grav | move_can_pitfall); | |
| 10076 | 213744 | tempguy.weap_data.override_flags = 0; | |
| 10077 | 213744 | tempguy.weap_data.hxofs = 0; | |
| 10078 | 213744 | tempguy.weap_data.hyofs = 0; | |
| 10079 | 213744 | tempguy.weap_data.hxsz = 0; | |
| 10080 | 213744 | tempguy.weap_data.hysz = 0; | |
| 10081 | 213744 | tempguy.weap_data.hzsz = 0; | |
| 10082 | 213744 | tempguy.weap_data.xofs = 0; | |
| 10083 | 213744 | tempguy.weap_data.yofs = 0; | |
| 10084 | 213744 | tempguy.weap_data.tilew = 0; | |
| 10085 | 213744 | tempguy.weap_data.tileh = 0; | |
| 10086 |
5/5✓ Branch 0 taken 2556 times.
✓ Branch 1 taken 171721 times.
✓ Branch 2 taken 18856 times.
✓ Branch 3 taken 13082 times.
✓ Branch 4 taken 7529 times.
|
213744 | switch (tempguy.weapon) |
| 10087 | { | ||
| 10088 | case ewFireball: case ewFireball2: | ||
| 10089 | 13082 | tempguy.weap_data.step = 1.75_zf; | |
| 10090 | 13082 | break; | |
| 10091 | case ewSword: case ewLitBomb: case ewLitSBomb: | ||
| 10092 | case ewRock: case ewMagic: case ewWind: | ||
| 10093 | 18856 | tempguy.weap_data.step = 3_zf; | |
| 10094 | 18856 | break; | |
| 10095 | case ewArrow: | ||
| 10096 | 2556 | tempguy.weap_data.step = 2_zf; | |
| 10097 | 2556 | break; | |
| 10098 | case ewFlame: case ewFlame2: | ||
| 10099 | 7529 | tempguy.weap_data.step = 1_zf; | |
| 10100 | 7529 | break; | |
| 10101 | default: | ||
| 10102 | 171721 | tempguy.weap_data.step = 0_zf; | |
| 10103 | 171721 | break; | |
| 10104 | } | ||
| 10105 |
2/2✓ Branch 0 taken 1068720 times.
✓ Branch 1 taken 213744 times.
|
1282464 | for (int q = 0; q < WPNSPR_MAX; ++q) |
| 10106 | { | ||
| 10107 | 1068720 | tempguy.weap_data.burnsprs[q] = 0; | |
| 10108 | 1068720 | tempguy.weap_data.light_rads[q] = 0; | |
| 10109 | 1068720 | } | |
| 10110 | 213744 | } | |
| 10111 | |||
| 10112 | 213744 | static void guy_update_weaponspecialsfx(guydata& tempguy) | |
| 10113 | { | ||
| 10114 |
3/3✓ Branch 0 taken 2311 times.
✓ Branch 1 taken 208975 times.
✓ Branch 2 taken 2458 times.
|
213744 | switch (tempguy.weapon) |
| 10115 | { | ||
| 10116 | case ewBrang: | ||
| 10117 | 2311 | tempguy.specialsfx = WAV_BRANG; | |
| 10118 | 2311 | break; | |
| 10119 | case ewBomb: case ewSBomb: case ewLitBomb:case ewLitSBomb: | ||
| 10120 | 2458 | tempguy.specialsfx = WAV_BOMB; | |
| 10121 | 2458 | break; | |
| 10122 | default: | ||
| 10123 | 208975 | tempguy.specialsfx = 0; | |
| 10124 | 208975 | break; | |
| 10125 | } | ||
| 10126 | 213744 | } | |
| 10127 | |||
| 10128 | 496 | void init_guys(int32_t guyversion) | |
| 10129 | { | ||
| 10130 |
2/2✓ Branch 0 taken 253952 times.
✓ Branch 1 taken 496 times.
|
254448 | for(int32_t i=0; i<MAXGUYS; i++) |
| 10131 | { | ||
| 10132 | 253952 | guysbuf[i] = default_guys[0]; | |
| 10133 | 253952 | } | |
| 10134 | |||
| 10135 |
2/2✓ Branch 0 taken 87792 times.
✓ Branch 1 taken 496 times.
|
88288 | for(int32_t i=0; i<OLDMAXGUYS; i++) |
| 10136 | { | ||
| 10137 | 87792 | guysbuf[i] = default_guys[i]; | |
| 10138 |
2/2✓ Branch 0 taken 86800 times.
✓ Branch 1 taken 992 times.
|
87792 | guysbuf[i].spr_shadow = (guysbuf[i].type==eeROCK && guysbuf[i].attributes[9] == 1) ? iwLargeShadow : iwShadow; |
| 10139 | 87792 | guysbuf[i].spr_death = iwDeath; | |
| 10140 | 87792 | guysbuf[i].spr_spawn = iwSpawn; | |
| 10141 | // Patra fix: 2.10 BSPatras used spDIG. 2.50 Patras use CSet 7. | ||
| 10142 |
4/4✓ Branch 0 taken 14337 times.
✓ Branch 1 taken 73455 times.
✓ Branch 2 taken 14256 times.
✓ Branch 3 taken 81 times.
|
87792 | if(guyversion<=3 && i==ePATRABS) |
| 10143 | { | ||
| 10144 | 81 | guysbuf[i].bosspal=spDIG; | |
| 10145 | 81 | guysbuf[i].cset=14; | |
| 10146 | 81 | guysbuf[i].attributes[8] = 14; | |
| 10147 | 81 | } | |
| 10148 | |||
| 10149 |
2/2✓ Branch 0 taken 73455 times.
✓ Branch 1 taken 14337 times.
|
87792 | if(guyversion<=3) |
| 10150 | { | ||
| 10151 | // Rope/Ghini Flash rules | ||
| 10152 |
2/2✓ Branch 0 taken 4071 times.
✓ Branch 1 taken 10266 times.
|
14337 | if(get_bit(deprecated_rules, qr_NOROPE2FLASH_DEP)) |
| 10153 | { | ||
| 10154 |
2/2✓ Branch 0 taken 10208 times.
✓ Branch 1 taken 58 times.
|
10266 | if(i==eROPE2) |
| 10155 | { | ||
| 10156 | 58 | guysbuf[i].flags &= ~guy_flashing; | |
| 10157 | 58 | } | |
| 10158 | 10266 | } | |
| 10159 | |||
| 10160 |
2/2✓ Branch 0 taken 12213 times.
✓ Branch 1 taken 2124 times.
|
14337 | if(get_bit(deprecated_rules, qr_NOBUBBLEFLASH_DEP)) |
| 10161 | { | ||
| 10162 |
12/12✓ Branch 0 taken 2112 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 2100 times.
✓ Branch 3 taken 12 times.
✓ Branch 4 taken 2088 times.
✓ Branch 5 taken 12 times.
✓ Branch 6 taken 2076 times.
✓ Branch 7 taken 12 times.
✓ Branch 8 taken 2064 times.
✓ Branch 9 taken 12 times.
✓ Branch 10 taken 12 times.
✓ Branch 11 taken 2052 times.
|
2124 | if(i==eBUBBLEST || i==eBUBBLESP || i==eBUBBLESR || i==eBUBBLEIT || i==eBUBBLEIP || i==eBUBBLEIR) |
| 10163 | { | ||
| 10164 | 72 | guysbuf[i].flags &= ~guy_flashing; | |
| 10165 | 72 | } | |
| 10166 | 2124 | } | |
| 10167 | |||
| 10168 |
2/2✓ Branch 0 taken 14256 times.
✓ Branch 1 taken 81 times.
|
14337 | if(i==eGHINI2) |
| 10169 | { | ||
| 10170 |
2/2✓ Branch 0 taken 77 times.
✓ Branch 1 taken 4 times.
|
81 | if(get_bit(deprecated_rules, qr_GHINI2BLINK_DEP)) |
| 10171 | { | ||
| 10172 | 4 | guysbuf[i].flags |= guy_blinking; | |
| 10173 | 4 | } | |
| 10174 | |||
| 10175 |
2/2✓ Branch 0 taken 43 times.
✓ Branch 1 taken 38 times.
|
81 | if(get_bit(deprecated_rules, qr_PHANTOMGHINI2_DEP)) |
| 10176 | { | ||
| 10177 | 38 | guysbuf[i].flags |= guy_transparent; | |
| 10178 | 38 | } | |
| 10179 | 81 | } | |
| 10180 | |||
| 10181 |
4/4✓ Branch 0 taken 14256 times.
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 81 times.
✓ Branch 3 taken 14175 times.
|
14337 | if (i == eDIG1 || i == eDIG3) |
| 10182 | { | ||
| 10183 | 162 | guysbuf[i].flags |= guy_ignore_kill_all; | |
| 10184 | 162 | } | |
| 10185 | 14337 | } | |
| 10186 | |||
| 10187 | // Darknut fix | ||
| 10188 |
10/10✓ Branch 0 taken 87296 times.
✓ Branch 1 taken 496 times.
✓ Branch 2 taken 86800 times.
✓ Branch 3 taken 496 times.
✓ Branch 4 taken 86304 times.
✓ Branch 5 taken 496 times.
✓ Branch 6 taken 85808 times.
✓ Branch 7 taken 496 times.
✓ Branch 8 taken 496 times.
✓ Branch 9 taken 85312 times.
|
87792 | if(i==eDKNUT1 || i==eDKNUT2 || i==eDKNUT3 || i==eDKNUT4 || i==eDKNUT5) |
| 10189 | { | ||
| 10190 |
2/2✓ Branch 0 taken 2070 times.
✓ Branch 1 taken 410 times.
|
2480 | if(get_qr(qr_NEWENEMYTILES)) |
| 10191 | { | ||
| 10192 | 2070 | guysbuf[i].s_tile=guysbuf[i].e_tile+120; | |
| 10193 | 2070 | guysbuf[i].s_width=guysbuf[i].e_width; | |
| 10194 | 2070 | guysbuf[i].s_height=guysbuf[i].e_height; | |
| 10195 | 2070 | } | |
| 10196 | 410 | else guysbuf[i].s_tile=860; | |
| 10197 | |||
| 10198 |
2/2✓ Branch 0 taken 315 times.
✓ Branch 1 taken 2165 times.
|
2480 | if(!get_bit(deprecated_rules,qr_BRKBLSHLDS_DEP)) |
| 10199 | 2165 | guysbuf[i].flags &= ~guy_bkshield; | |
| 10200 | else | ||
| 10201 | 315 | guysbuf[i].flags |= guy_bkshield; | |
| 10202 | 2480 | } | |
| 10203 | |||
| 10204 |
4/4✓ Branch 0 taken 87296 times.
✓ Branch 1 taken 496 times.
✓ Branch 2 taken 87742 times.
✓ Branch 3 taken 50 times.
|
87792 | if((i==eGELTRIB || i==eFGELTRIB) && get_bit(deprecated_rules,qr_OLDTRIBBLES_DEP)) |
| 10205 | { | ||
| 10206 | 50 | guysbuf[i].attributes[2] = (i == eFGELTRIB ? eFZOL : eZOL); | |
| 10207 | 50 | } | |
| 10208 | |||
| 10209 | 87792 | guy_update_firesfx(guysbuf[i]); | |
| 10210 | 87792 | guy_update_weaponflags(guysbuf[i]); | |
| 10211 | 87792 | guy_update_weaponspecialsfx(guysbuf[i]); | |
| 10212 | 87792 | } | |
| 10213 | 496 | } | |
| 10214 | |||
| 10215 | 20736 | void reset_weaponname(int32_t i) | |
| 10216 | { | ||
| 10217 |
2/2✓ Branch 0 taken 7128 times.
✓ Branch 1 taken 13608 times.
|
20736 | if(i<wLast) |
| 10218 | { | ||
| 10219 | 7128 | strcpy(weapon_string[i],old_weapon_string[i]); | |
| 10220 | 7128 | } | |
| 10221 | else | ||
| 10222 | 13608 | sprintf(weapon_string[i],"zz%03d",i); | |
| 10223 | 20736 | } | |
| 10224 | |||
| 10225 | 496 | void init_item_drop_sets() | |
| 10226 | { | ||
| 10227 |
2/2✓ Branch 0 taken 126976 times.
✓ Branch 1 taken 496 times.
|
127472 | for(int32_t i=0; i<MAXITEMDROPSETS; i++) |
| 10228 | { | ||
| 10229 | // item_drop_sets[i] = default_item_drop_sets[0]; | ||
| 10230 | 126976 | memset(&item_drop_sets[i], 0, sizeof(item_drop_object)); | |
| 10231 | 126976 | } | |
| 10232 | |||
| 10233 |
2/2✓ Branch 0 taken 6448 times.
✓ Branch 1 taken 496 times.
|
6944 | for(int32_t i=0; i<isMAX; i++) |
| 10234 | { | ||
| 10235 | 6448 | item_drop_sets[i] = default_item_drop_sets[i]; | |
| 10236 | |||
| 10237 | // Deprecated: qr_NOCLOCKS and qr_ALLOW10RUPEEDROPS | ||
| 10238 |
2/2✓ Branch 0 taken 64480 times.
✓ Branch 1 taken 6448 times.
|
70928 | for(int32_t j=0; j<10; ++j) |
| 10239 | { | ||
| 10240 | 64480 | int32_t it = item_drop_sets[i].item[j]; | |
| 10241 | |||
| 10242 |
3/4✓ Branch 0 taken 45356 times.
✓ Branch 1 taken 19124 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2928 times.
|
64480 | if((itemsbuf[it].type == itype_rupee && ((itemsbuf[it].amount)&0xFFF) == 10) |
| 10243 |
2/2✓ Branch 0 taken 2928 times.
✓ Branch 1 taken 42428 times.
|
45356 | && !get_bit(deprecated_rules, qr_ALLOW10RUPEEDROPS_DEP)) |
| 10244 | { | ||
| 10245 | 2928 | item_drop_sets[i].chance[j+1]=0; | |
| 10246 | 2928 | } | |
| 10247 |
4/4✓ Branch 0 taken 1984 times.
✓ Branch 1 taken 59568 times.
✓ Branch 2 taken 144 times.
✓ Branch 3 taken 1840 times.
|
61552 | else if(itemsbuf[it].type == itype_clock && get_bit(deprecated_rules, qr_NOCLOCKS_DEP)) |
| 10248 | { | ||
| 10249 | 144 | item_drop_sets[i].chance[j+1]=0; | |
| 10250 | 144 | } | |
| 10251 | |||
| 10252 | // From Sept 2007 to Dec 2008, non-gameplay items were prohibited. | ||
| 10253 |
2/2✓ Branch 0 taken 64456 times.
✓ Branch 1 taken 24 times.
|
64480 | if(itemsbuf[it].type == itype_misc) |
| 10254 | { | ||
| 10255 | // If a non-gameplay item was selected, then item drop was aborted. | ||
| 10256 | // Reflect this by increasing the 'Nothing' chance accordingly. | ||
| 10257 | 24 | item_drop_sets[i].chance[0]+=item_drop_sets[i].chance[j+1]; | |
| 10258 | 24 | item_drop_sets[i].chance[j+1]=0; | |
| 10259 | 24 | } | |
| 10260 | 64480 | } | |
| 10261 | 6448 | } | |
| 10262 | 496 | } | |
| 10263 | |||
| 10264 | 496 | void init_favorites() | |
| 10265 | { | ||
| 10266 |
2/2✓ Branch 0 taken 624960 times.
✓ Branch 1 taken 496 times.
|
625456 | for(int32_t i=0; i<MAXFAVORITECOMBOS; i++) |
| 10267 | { | ||
| 10268 | 624960 | favorite_combos[i]=-1; | |
| 10269 | 624960 | } | |
| 10270 | 496 | } | |
| 10271 | |||
| 10272 | 782 | int32_t init_combo_classes() | |
| 10273 | { | ||
| 10274 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 782 times.
|
782 | zinfo* zi = (load_tmp_zi ? load_tmp_zi : &ZI); |
| 10275 |
2/2✓ Branch 0 taken 143888 times.
✓ Branch 1 taken 782 times.
|
144670 | for(int32_t i=0; i<cMAX; i++) |
| 10276 | { | ||
| 10277 | 143888 | combo_class_buf[i] = default_combo_classes[i]; | |
| 10278 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143888 times.
|
143888 | if ( char const* nm = zi->getComboTypeName(i) ) |
| 10279 | { | ||
| 10280 | 143888 | size_t len = strlen(nm); | |
| 10281 |
2/2✓ Branch 0 taken 9208832 times.
✓ Branch 1 taken 143888 times.
|
9352720 | for ( size_t q = 0; q < 64; q++ ) |
| 10282 | { | ||
| 10283 |
2/2✓ Branch 0 taken 2109054 times.
✓ Branch 1 taken 7099778 times.
|
9208832 | combo_class_buf[i].name[q] = (q<len ? nm[q] : 0); |
| 10284 | 9208832 | } | |
| 10285 | 143888 | } | |
| 10286 | 143888 | } | |
| 10287 | |||
| 10288 | 782 | return 0; | |
| 10289 | } | ||
| 10290 | |||
| 10291 | 304 | int32_t readherosprites2(PACKFILE *f, int32_t v_herosprites) | |
| 10292 | { | ||
| 10293 |
2/2✓ Branch 0 taken 46 times.
✓ Branch 1 taken 258 times.
|
304 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_herosprites); |
| 10294 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 304 times.
|
304 | if (should_skip) return 0; |
| 10295 | |||
| 10296 |
1/2✓ Branch 0 taken 304 times.
✗ Branch 1 not taken.
|
304 | assert(v_herosprites < 6); |
| 10297 | |||
| 10298 | 304 | zinit.hero_swim_speed=67; //default | |
| 10299 | 304 | setupherotiles(zinit.heroAnimationStyle); | |
| 10300 | 304 | setupherodefenses(); | |
| 10301 | 304 | setupherooffsets(); | |
| 10302 | |||
| 10303 |
2/2✓ Branch 0 taken 104 times.
✓ Branch 1 taken 200 times.
|
304 | if(v_herosprites>=0) |
| 10304 | { | ||
| 10305 | word tile, tile2; | ||
| 10306 | byte flip, extend, dummy_byte; | ||
| 10307 | |||
| 10308 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<4; i++) |
| 10309 | { | ||
| 10310 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10311 | { | ||
| 10312 | ✗ | return qe_invalid; | |
| 10313 | } | ||
| 10314 | |||
| 10315 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10316 | { | ||
| 10317 | ✗ | return qe_invalid; | |
| 10318 | } | ||
| 10319 | |||
| 10320 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&extend,f)) |
| 10321 | { | ||
| 10322 | ✗ | return qe_invalid; | |
| 10323 | } | ||
| 10324 | |||
| 10325 | 800 | walkspr[i][spr_tile]=(int32_t)tile; | |
| 10326 | 800 | walkspr[i][spr_flip]=(int32_t)flip; | |
| 10327 | 800 | walkspr[i][spr_extend]=(int32_t)extend; | |
| 10328 | 800 | } | |
| 10329 | |||
| 10330 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<4; i++) |
| 10331 | { | ||
| 10332 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10333 | { | ||
| 10334 | ✗ | return qe_invalid; | |
| 10335 | } | ||
| 10336 | |||
| 10337 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10338 | { | ||
| 10339 | ✗ | return qe_invalid; | |
| 10340 | } | ||
| 10341 | |||
| 10342 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&extend,f)) |
| 10343 | { | ||
| 10344 | ✗ | return qe_invalid; | |
| 10345 | } | ||
| 10346 | |||
| 10347 | 800 | stabspr[i][spr_tile]=(int32_t)tile; | |
| 10348 | 800 | stabspr[i][spr_flip]=(int32_t)flip; | |
| 10349 | 800 | stabspr[i][spr_extend]=(int32_t)extend; | |
| 10350 | 800 | } | |
| 10351 | |||
| 10352 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<4; i++) |
| 10353 | { | ||
| 10354 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10355 | { | ||
| 10356 | ✗ | return qe_invalid; | |
| 10357 | } | ||
| 10358 | |||
| 10359 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10360 | { | ||
| 10361 | ✗ | return qe_invalid; | |
| 10362 | } | ||
| 10363 | |||
| 10364 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&extend,f)) |
| 10365 | { | ||
| 10366 | ✗ | return qe_invalid; | |
| 10367 | } | ||
| 10368 | |||
| 10369 | 800 | slashspr[i][spr_tile]=(int32_t)tile; | |
| 10370 | 800 | slashspr[i][spr_flip]=(int32_t)flip; | |
| 10371 | 800 | slashspr[i][spr_extend]=(int32_t)extend; | |
| 10372 | 800 | } | |
| 10373 | |||
| 10374 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<4; i++) |
| 10375 | { | ||
| 10376 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10377 | { | ||
| 10378 | ✗ | return qe_invalid; | |
| 10379 | } | ||
| 10380 | |||
| 10381 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10382 | { | ||
| 10383 | ✗ | return qe_invalid; | |
| 10384 | } | ||
| 10385 | |||
| 10386 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&extend,f)) |
| 10387 | { | ||
| 10388 | ✗ | return qe_invalid; | |
| 10389 | } | ||
| 10390 | |||
| 10391 | 800 | floatspr[i][spr_tile]=(int32_t)tile; | |
| 10392 | 800 | floatspr[i][spr_flip]=(int32_t)flip; | |
| 10393 | 800 | floatspr[i][spr_extend]=(int32_t)extend; | |
| 10394 | 800 | } | |
| 10395 | |||
| 10396 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if(v_herosprites>1) |
| 10397 | { | ||
| 10398 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<4; i++) |
| 10399 | { | ||
| 10400 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10401 | { | ||
| 10402 | ✗ | return qe_invalid; | |
| 10403 | } | ||
| 10404 | |||
| 10405 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10406 | { | ||
| 10407 | ✗ | return qe_invalid; | |
| 10408 | } | ||
| 10409 | |||
| 10410 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&extend,f)) |
| 10411 | { | ||
| 10412 | ✗ | return qe_invalid; | |
| 10413 | } | ||
| 10414 | |||
| 10415 | 800 | swimspr[i][spr_tile]=(int32_t)tile; | |
| 10416 | 800 | swimspr[i][spr_flip]=(int32_t)flip; | |
| 10417 | 800 | swimspr[i][spr_extend]=(int32_t)extend; | |
| 10418 | 800 | } | |
| 10419 | 200 | } | |
| 10420 | |||
| 10421 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<4; i++) |
| 10422 | { | ||
| 10423 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10424 | { | ||
| 10425 | ✗ | return qe_invalid; | |
| 10426 | } | ||
| 10427 | |||
| 10428 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10429 | { | ||
| 10430 | ✗ | return qe_invalid; | |
| 10431 | } | ||
| 10432 | |||
| 10433 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&extend,f)) |
| 10434 | { | ||
| 10435 | ✗ | return qe_invalid; | |
| 10436 | } | ||
| 10437 | |||
| 10438 | 800 | divespr[i][spr_tile]=(int32_t)tile; | |
| 10439 | 800 | divespr[i][spr_flip]=(int32_t)flip; | |
| 10440 | 800 | divespr[i][spr_extend]=(int32_t)extend; | |
| 10441 | 800 | } | |
| 10442 | |||
| 10443 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<4; i++) |
| 10444 | { | ||
| 10445 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10446 | { | ||
| 10447 | ✗ | return qe_invalid; | |
| 10448 | } | ||
| 10449 | |||
| 10450 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10451 | { | ||
| 10452 | ✗ | return qe_invalid; | |
| 10453 | } | ||
| 10454 | |||
| 10455 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&extend,f)) |
| 10456 | { | ||
| 10457 | ✗ | return qe_invalid; | |
| 10458 | } | ||
| 10459 | |||
| 10460 | 800 | poundspr[i][spr_tile]=(int32_t)tile; | |
| 10461 | 800 | poundspr[i][spr_flip]=(int32_t)flip; | |
| 10462 | 800 | poundspr[i][spr_extend]=(int32_t)extend; | |
| 10463 | 800 | } | |
| 10464 | |||
| 10465 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(!p_igetw(&tile,f)) |
| 10466 | { | ||
| 10467 | ✗ | return qe_invalid; | |
| 10468 | } | ||
| 10469 | |||
| 10470 | 200 | flip=0; | |
| 10471 | |||
| 10472 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if(v_herosprites>0) |
| 10473 | { | ||
| 10474 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(!p_getc(&flip,f)) |
| 10475 | { | ||
| 10476 | ✗ | return qe_invalid; | |
| 10477 | } | ||
| 10478 | 200 | } | |
| 10479 | |||
| 10480 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(!p_getc(&extend,f)) |
| 10481 | { | ||
| 10482 | ✗ | return qe_invalid; | |
| 10483 | } | ||
| 10484 | |||
| 10485 | 200 | castingspr[spr_tile]=(int32_t)tile; | |
| 10486 | 200 | castingspr[spr_flip]=(int32_t)flip; | |
| 10487 | 200 | castingspr[spr_extend]=(int32_t)extend; | |
| 10488 | |||
| 10489 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(v_herosprites>0) |
| 10490 | { | ||
| 10491 | 200 | int32_t num_holdsprs = (v_herosprites > 6 ? 3 : 2); | |
| 10492 |
2/2✓ Branch 0 taken 400 times.
✓ Branch 1 taken 200 times.
|
600 | for(int32_t i=0; i<2; i++) |
| 10493 | { | ||
| 10494 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 400 times.
|
1200 | for(int32_t j=0; j<num_holdsprs; j++) |
| 10495 | { | ||
| 10496 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10497 | { | ||
| 10498 | ✗ | return qe_invalid; | |
| 10499 | } | ||
| 10500 | |||
| 10501 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10502 | { | ||
| 10503 | ✗ | return qe_invalid; | |
| 10504 | } | ||
| 10505 | |||
| 10506 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&extend,f)) |
| 10507 | { | ||
| 10508 | ✗ | return qe_invalid; | |
| 10509 | } | ||
| 10510 | |||
| 10511 | 800 | holdspr[i][j][spr_tile]=(int32_t)tile; | |
| 10512 | 800 | holdspr[i][j][spr_flip]=(int32_t)flip; | |
| 10513 | 800 | holdspr[i][j][spr_extend]=(int32_t)extend; | |
| 10514 | 800 | } | |
| 10515 | 400 | } | |
| 10516 | 200 | } | |
| 10517 | else | ||
| 10518 | { | ||
| 10519 | ✗ | for(int32_t i=0; i<2; i++) | |
| 10520 | { | ||
| 10521 | ✗ | if(!p_igetw(&tile,f)) | |
| 10522 | { | ||
| 10523 | ✗ | return qe_invalid; | |
| 10524 | } | ||
| 10525 | |||
| 10526 | ✗ | if(!p_igetw(&tile2,f)) | |
| 10527 | { | ||
| 10528 | ✗ | return qe_invalid; | |
| 10529 | } | ||
| 10530 | |||
| 10531 | ✗ | if(!p_getc(&extend,f)) | |
| 10532 | { | ||
| 10533 | ✗ | return qe_invalid; | |
| 10534 | } | ||
| 10535 | |||
| 10536 | ✗ | holdspr[i][spr_hold1][spr_tile]=(int32_t)tile; | |
| 10537 | ✗ | holdspr[i][spr_hold1][spr_flip]=(int32_t)flip; | |
| 10538 | ✗ | holdspr[i][spr_hold1][spr_extend]=(int32_t)extend; | |
| 10539 | ✗ | holdspr[i][spr_hold2][spr_tile]=(int32_t)tile2; | |
| 10540 | ✗ | holdspr[i][spr_hold2][spr_flip]=(int32_t)flip; | |
| 10541 | ✗ | holdspr[i][spr_hold2][spr_extend]=(int32_t)extend; | |
| 10542 | ✗ | } | |
| 10543 | } | ||
| 10544 | |||
| 10545 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if(v_herosprites>2) |
| 10546 | { | ||
| 10547 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<4; i++) |
| 10548 | { | ||
| 10549 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10550 | { | ||
| 10551 | ✗ | return qe_invalid; | |
| 10552 | } | ||
| 10553 | |||
| 10554 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10555 | { | ||
| 10556 | ✗ | return qe_invalid; | |
| 10557 | } | ||
| 10558 | |||
| 10559 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&extend,f)) |
| 10560 | { | ||
| 10561 | ✗ | return qe_invalid; | |
| 10562 | } | ||
| 10563 | |||
| 10564 | 800 | jumpspr[i][spr_tile]=(int32_t)tile; | |
| 10565 | 800 | jumpspr[i][spr_flip]=(int32_t)flip; | |
| 10566 | 800 | jumpspr[i][spr_extend]=(int32_t)extend; | |
| 10567 | 800 | } | |
| 10568 | 200 | } | |
| 10569 | |||
| 10570 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if(v_herosprites>3) |
| 10571 | { | ||
| 10572 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<4; i++) |
| 10573 | { | ||
| 10574 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10575 | { | ||
| 10576 | ✗ | return qe_invalid; | |
| 10577 | } | ||
| 10578 | |||
| 10579 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10580 | { | ||
| 10581 | ✗ | return qe_invalid; | |
| 10582 | } | ||
| 10583 | |||
| 10584 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 800 times.
|
800 | if(!p_getc(&extend,f)) |
| 10585 | { | ||
| 10586 | ✗ | return qe_invalid; | |
| 10587 | } | ||
| 10588 | |||
| 10589 | 800 | chargespr[i][spr_tile]=(int32_t)tile; | |
| 10590 | 800 | chargespr[i][spr_flip]=(int32_t)flip; | |
| 10591 | 800 | chargespr[i][spr_extend]=(int32_t)extend; | |
| 10592 | 800 | } | |
| 10593 | 200 | } | |
| 10594 | |||
| 10595 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if(v_herosprites>4) |
| 10596 | { | ||
| 10597 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(!p_getc(&dummy_byte,f)) |
| 10598 | { | ||
| 10599 | ✗ | return qe_invalid; | |
| 10600 | } | ||
| 10601 | |||
| 10602 | 200 | zinit.hero_swim_speed=(byte)dummy_byte; | |
| 10603 | 200 | } | |
| 10604 | |||
| 10605 | 200 | memset(frozenspr, 0, sizeof(frozenspr)); | |
| 10606 | 200 | memset(frozen_waterspr, 0, sizeof(frozen_waterspr)); | |
| 10607 | 200 | memset(onfirespr, 0, sizeof(onfirespr)); | |
| 10608 | 200 | memset(onfire_waterspr, 0, sizeof(onfire_waterspr)); | |
| 10609 | 200 | memset(diggingspr, 0, sizeof(diggingspr)); | |
| 10610 | 200 | memset(usingrodspr, 0, sizeof(usingrodspr)); | |
| 10611 | 200 | memset(usingcanespr, 0, sizeof(usingcanespr)); | |
| 10612 | 200 | memset(pushingspr, 0, sizeof(pushingspr)); | |
| 10613 | 200 | memset(liftingspr, 0, sizeof(liftingspr)); | |
| 10614 | 200 | memset(liftingwalkspr, 0, sizeof(liftingwalkspr)); | |
| 10615 | 200 | memset(stunnedspr, 0, sizeof(stunnedspr)); | |
| 10616 | 200 | memset(stunned_waterspr, 0, sizeof(stunned_waterspr)); | |
| 10617 | 200 | memset(fallingspr, 0, sizeof(fallingspr)); | |
| 10618 | 200 | memset(shockedspr, 0, sizeof(shockedspr)); | |
| 10619 | 200 | memset(shocked_waterspr, 0, sizeof(shocked_waterspr)); | |
| 10620 | 200 | memset(pullswordspr, 0, sizeof(pullswordspr)); | |
| 10621 | 200 | memset(readingspr, 0, sizeof(readingspr)); | |
| 10622 | 200 | memset(slash180spr, 0, sizeof(slash180spr)); | |
| 10623 | 200 | memset(slashZ4spr, 0, sizeof(slashZ4spr)); | |
| 10624 | 200 | memset(dashspr, 0, sizeof(dashspr)); | |
| 10625 | 200 | memset(bonkspr, 0, sizeof(bonkspr)); | |
| 10626 | 200 | memset(medallionsprs, 0, sizeof(medallionsprs)); | |
| 10627 | 200 | memset(holdspr[0][2], 0, sizeof(holdspr[0][2])); //Sword hold (Land) | |
| 10628 | 200 | memset(holdspr[1][2], 0, sizeof(holdspr[1][2])); //Sword hold (Water) | |
| 10629 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t q = 0; q < 4; ++q) |
| 10630 | { | ||
| 10631 |
2/2✓ Branch 0 taken 2400 times.
✓ Branch 1 taken 800 times.
|
3200 | for(int32_t p = 0; p < 3; ++p) |
| 10632 | { | ||
| 10633 | 2400 | drowningspr[q][p] = divespr[q][p]; | |
| 10634 | 2400 | drowning_lavaspr[q][p] = divespr[q][p]; | |
| 10635 | 2400 | } | |
| 10636 | 800 | } | |
| 10637 | 200 | memset(sideswimspr, 0, sizeof(sideswimspr)); | |
| 10638 | 200 | memset(sideswimslashspr, 0, sizeof(sideswimslashspr)); | |
| 10639 | 200 | memset(sideswimstabspr, 0, sizeof(sideswimstabspr)); | |
| 10640 | 200 | memset(sideswimpoundspr, 0, sizeof(sideswimpoundspr)); | |
| 10641 | 200 | memset(sideswimchargespr, 0, sizeof(sideswimchargespr)); | |
| 10642 | 200 | memset(sideswimholdspr, 0, sizeof(sideswimholdspr)); | |
| 10643 | 200 | memset(sidedrowningspr, 0, sizeof(sidedrowningspr)); | |
| 10644 | 200 | } | |
| 10645 | |||
| 10646 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 304 times.
|
304 | if(FFCore.quest_format[vInitData] < 34) |
| 10647 | { | ||
| 10648 | 304 | bool fastswim = zinit.hero_swim_speed > 60; | |
| 10649 | // '2/3' or '1/2' | ||
| 10650 | 304 | zinit.hero_swim_mult = fastswim ? 2 : 1; | |
| 10651 | 304 | zinit.hero_swim_div = fastswim ? 3 : 2; | |
| 10652 | 304 | } | |
| 10653 | 304 | return 0; | |
| 10654 | 304 | } | |
| 10655 | |||
| 10656 | 36550 | void setSprite(int32_t* arr, int32_t tile, int32_t flip, int32_t ext) | |
| 10657 | { | ||
| 10658 | 36550 | arr[spr_tile] = tile; | |
| 10659 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36550 times.
|
36550 | arr[spr_flip] = (flip > 3 ? 0 : flip); |
| 10660 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36550 times.
|
36550 | arr[spr_extend] = (ext > 2 ? 0 : ext); |
| 10661 | 36550 | } | |
| 10662 | //Used to read the player sprites as int32_t, not word. | ||
| 10663 | 215 | int32_t readherosprites3(PACKFILE *f, int32_t v_herosprites) | |
| 10664 | { | ||
| 10665 | 215 | zinit.hero_swim_speed=67; //default | |
| 10666 | 215 | setupherotiles(zinit.heroAnimationStyle); | |
| 10667 | 215 | setupherodefenses(); | |
| 10668 | 215 | setupherooffsets(); | |
| 10669 | |||
| 10670 | int32_t tile, tile2; | ||
| 10671 | byte flip, extend, dummy_byte; | ||
| 10672 | |||
| 10673 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 215 times.
|
215 | if(v_herosprites>=0) |
| 10674 | { | ||
| 10675 | |||
| 10676 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t i=0; i<4; i++) |
| 10677 | { | ||
| 10678 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 10679 | { | ||
| 10680 | ✗ | return qe_invalid; | |
| 10681 | } | ||
| 10682 | |||
| 10683 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 10684 | { | ||
| 10685 | ✗ | return qe_invalid; | |
| 10686 | } | ||
| 10687 | |||
| 10688 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 10689 | { | ||
| 10690 | ✗ | return qe_invalid; | |
| 10691 | } | ||
| 10692 | |||
| 10693 | 860 | setSprite(walkspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10694 | 860 | } | |
| 10695 | |||
| 10696 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t i=0; i<4; i++) |
| 10697 | { | ||
| 10698 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 10699 | { | ||
| 10700 | ✗ | return qe_invalid; | |
| 10701 | } | ||
| 10702 | |||
| 10703 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 10704 | { | ||
| 10705 | ✗ | return qe_invalid; | |
| 10706 | } | ||
| 10707 | |||
| 10708 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 10709 | { | ||
| 10710 | ✗ | return qe_invalid; | |
| 10711 | } | ||
| 10712 | |||
| 10713 | 860 | setSprite(stabspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10714 | 860 | } | |
| 10715 | |||
| 10716 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t i=0; i<4; i++) |
| 10717 | { | ||
| 10718 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 10719 | { | ||
| 10720 | ✗ | return qe_invalid; | |
| 10721 | } | ||
| 10722 | |||
| 10723 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 10724 | { | ||
| 10725 | ✗ | return qe_invalid; | |
| 10726 | } | ||
| 10727 | |||
| 10728 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 10729 | { | ||
| 10730 | ✗ | return qe_invalid; | |
| 10731 | } | ||
| 10732 | |||
| 10733 | 860 | setSprite(slashspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10734 | 860 | } | |
| 10735 | |||
| 10736 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t i=0; i<4; i++) |
| 10737 | { | ||
| 10738 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 10739 | { | ||
| 10740 | ✗ | return qe_invalid; | |
| 10741 | } | ||
| 10742 | |||
| 10743 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 10744 | { | ||
| 10745 | ✗ | return qe_invalid; | |
| 10746 | } | ||
| 10747 | |||
| 10748 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 10749 | { | ||
| 10750 | ✗ | return qe_invalid; | |
| 10751 | } | ||
| 10752 | |||
| 10753 | 860 | setSprite(floatspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10754 | 860 | } | |
| 10755 | |||
| 10756 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 215 times.
|
215 | if(v_herosprites>1) |
| 10757 | { | ||
| 10758 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t i=0; i<4; i++) |
| 10759 | { | ||
| 10760 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 10761 | { | ||
| 10762 | ✗ | return qe_invalid; | |
| 10763 | } | ||
| 10764 | |||
| 10765 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 10766 | { | ||
| 10767 | ✗ | return qe_invalid; | |
| 10768 | } | ||
| 10769 | |||
| 10770 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 10771 | { | ||
| 10772 | ✗ | return qe_invalid; | |
| 10773 | } | ||
| 10774 | |||
| 10775 | 860 | setSprite(swimspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10776 | 860 | } | |
| 10777 | 215 | } | |
| 10778 | |||
| 10779 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t i=0; i<4; i++) |
| 10780 | { | ||
| 10781 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 10782 | { | ||
| 10783 | ✗ | return qe_invalid; | |
| 10784 | } | ||
| 10785 | |||
| 10786 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 10787 | { | ||
| 10788 | ✗ | return qe_invalid; | |
| 10789 | } | ||
| 10790 | |||
| 10791 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 10792 | { | ||
| 10793 | ✗ | return qe_invalid; | |
| 10794 | } | ||
| 10795 | |||
| 10796 | 860 | setSprite(divespr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10797 | 860 | } | |
| 10798 | |||
| 10799 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t i=0; i<4; i++) |
| 10800 | { | ||
| 10801 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 10802 | { | ||
| 10803 | ✗ | return qe_invalid; | |
| 10804 | } | ||
| 10805 | |||
| 10806 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 10807 | { | ||
| 10808 | ✗ | return qe_invalid; | |
| 10809 | } | ||
| 10810 | |||
| 10811 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 10812 | { | ||
| 10813 | ✗ | return qe_invalid; | |
| 10814 | } | ||
| 10815 | |||
| 10816 | 860 | setSprite(poundspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10817 | 860 | } | |
| 10818 | |||
| 10819 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if(!p_igetl(&tile,f)) |
| 10820 | { | ||
| 10821 | ✗ | return qe_invalid; | |
| 10822 | } | ||
| 10823 | |||
| 10824 | 215 | flip=0; | |
| 10825 | |||
| 10826 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 215 times.
|
215 | if(v_herosprites>0) |
| 10827 | { | ||
| 10828 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if(!p_getc(&flip,f)) |
| 10829 | { | ||
| 10830 | ✗ | return qe_invalid; | |
| 10831 | } | ||
| 10832 | 215 | } | |
| 10833 | |||
| 10834 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if(!p_getc(&extend,f)) |
| 10835 | { | ||
| 10836 | ✗ | return qe_invalid; | |
| 10837 | } | ||
| 10838 | |||
| 10839 | 215 | setSprite(castingspr, int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10840 | |||
| 10841 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if(v_herosprites>0) |
| 10842 | { | ||
| 10843 | 215 | int32_t num_holdsprs = (v_herosprites > 6 ? 3 : 2); | |
| 10844 |
2/2✓ Branch 0 taken 430 times.
✓ Branch 1 taken 215 times.
|
645 | for(int32_t i=0; i<2; i++) |
| 10845 | { | ||
| 10846 |
2/2✓ Branch 0 taken 1290 times.
✓ Branch 1 taken 430 times.
|
1720 | for(int32_t j=0; j<num_holdsprs; j++) |
| 10847 | { | ||
| 10848 |
1/2✓ Branch 0 taken 1290 times.
✗ Branch 1 not taken.
|
1290 | if(!p_igetl(&tile,f)) |
| 10849 | { | ||
| 10850 | ✗ | return qe_invalid; | |
| 10851 | } | ||
| 10852 | |||
| 10853 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1290 times.
|
1290 | if(!p_getc(&flip,f)) |
| 10854 | { | ||
| 10855 | ✗ | return qe_invalid; | |
| 10856 | } | ||
| 10857 | |||
| 10858 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1290 times.
|
1290 | if(!p_getc(&extend,f)) |
| 10859 | { | ||
| 10860 | ✗ | return qe_invalid; | |
| 10861 | } | ||
| 10862 | |||
| 10863 | 1290 | setSprite(holdspr[i][j], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10864 | 1290 | } | |
| 10865 | 430 | } | |
| 10866 | 215 | } | |
| 10867 | else | ||
| 10868 | { | ||
| 10869 | ✗ | for(int32_t i=0; i<2; i++) | |
| 10870 | { | ||
| 10871 | ✗ | if(!p_igetl(&tile,f)) | |
| 10872 | { | ||
| 10873 | ✗ | return qe_invalid; | |
| 10874 | } | ||
| 10875 | |||
| 10876 | ✗ | if(!p_igetl(&tile2,f)) | |
| 10877 | { | ||
| 10878 | ✗ | return qe_invalid; | |
| 10879 | } | ||
| 10880 | |||
| 10881 | ✗ | if(!p_getc(&extend,f)) | |
| 10882 | { | ||
| 10883 | ✗ | return qe_invalid; | |
| 10884 | } | ||
| 10885 | |||
| 10886 | ✗ | setSprite(holdspr[i][spr_hold1], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10887 | ✗ | setSprite(holdspr[i][spr_hold2], int32_t(tile2), int32_t(flip), int32_t(extend)); | |
| 10888 | ✗ | } | |
| 10889 | } | ||
| 10890 | |||
| 10891 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 215 times.
|
215 | if(v_herosprites>2) |
| 10892 | { | ||
| 10893 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t i=0; i<4; i++) |
| 10894 | { | ||
| 10895 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 10896 | { | ||
| 10897 | ✗ | return qe_invalid; | |
| 10898 | } | ||
| 10899 | |||
| 10900 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 10901 | { | ||
| 10902 | ✗ | return qe_invalid; | |
| 10903 | } | ||
| 10904 | |||
| 10905 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 10906 | { | ||
| 10907 | ✗ | return qe_invalid; | |
| 10908 | } | ||
| 10909 | |||
| 10910 | 860 | setSprite(jumpspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10911 | 860 | } | |
| 10912 | 215 | } | |
| 10913 | |||
| 10914 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 215 times.
|
215 | if(v_herosprites>3) |
| 10915 | { | ||
| 10916 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t i=0; i<4; i++) |
| 10917 | { | ||
| 10918 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 10919 | { | ||
| 10920 | ✗ | return qe_invalid; | |
| 10921 | } | ||
| 10922 | |||
| 10923 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 10924 | { | ||
| 10925 | ✗ | return qe_invalid; | |
| 10926 | } | ||
| 10927 | |||
| 10928 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 10929 | { | ||
| 10930 | ✗ | return qe_invalid; | |
| 10931 | } | ||
| 10932 | |||
| 10933 | 860 | setSprite(chargespr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10934 | 860 | } | |
| 10935 | 215 | } | |
| 10936 | |||
| 10937 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 215 times.
|
215 | if(v_herosprites>4) |
| 10938 | { | ||
| 10939 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if(!p_getc(&dummy_byte,f)) |
| 10940 | { | ||
| 10941 | ✗ | return qe_invalid; | |
| 10942 | } | ||
| 10943 | |||
| 10944 | 215 | zinit.hero_swim_speed=(byte)dummy_byte; | |
| 10945 | 215 | } | |
| 10946 | |||
| 10947 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if(v_herosprites>6) |
| 10948 | { | ||
| 10949 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 10950 | { | ||
| 10951 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 10952 | ✗ | return qe_invalid; | |
| 10953 | |||
| 10954 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 10955 | ✗ | return qe_invalid; | |
| 10956 | |||
| 10957 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 10958 | ✗ | return qe_invalid; | |
| 10959 | |||
| 10960 | 860 | setSprite(frozenspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10961 | 860 | } | |
| 10962 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 10963 | { | ||
| 10964 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 10965 | ✗ | return qe_invalid; | |
| 10966 | |||
| 10967 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 10968 | ✗ | return qe_invalid; | |
| 10969 | |||
| 10970 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 10971 | ✗ | return qe_invalid; | |
| 10972 | |||
| 10973 | 860 | setSprite(frozen_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10974 | 860 | } | |
| 10975 | |||
| 10976 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 10977 | { | ||
| 10978 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 10979 | ✗ | return qe_invalid; | |
| 10980 | |||
| 10981 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 10982 | ✗ | return qe_invalid; | |
| 10983 | |||
| 10984 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 10985 | ✗ | return qe_invalid; | |
| 10986 | |||
| 10987 | 860 | setSprite(onfirespr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10988 | 860 | } | |
| 10989 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 10990 | { | ||
| 10991 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 10992 | ✗ | return qe_invalid; | |
| 10993 | |||
| 10994 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 10995 | ✗ | return qe_invalid; | |
| 10996 | |||
| 10997 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 10998 | ✗ | return qe_invalid; | |
| 10999 | |||
| 11000 | 860 | setSprite(onfire_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11001 | 860 | } | |
| 11002 | |||
| 11003 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11004 | { | ||
| 11005 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11006 | ✗ | return qe_invalid; | |
| 11007 | |||
| 11008 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 11009 | ✗ | return qe_invalid; | |
| 11010 | |||
| 11011 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 11012 | ✗ | return qe_invalid; | |
| 11013 | |||
| 11014 | 860 | setSprite(diggingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11015 | 860 | } | |
| 11016 | |||
| 11017 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11018 | { | ||
| 11019 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11020 | ✗ | return qe_invalid; | |
| 11021 | |||
| 11022 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&flip,f)) |
| 11023 | ✗ | return qe_invalid; | |
| 11024 | |||
| 11025 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 11026 | ✗ | return qe_invalid; | |
| 11027 | |||
| 11028 | 860 | setSprite(usingrodspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11029 | 860 | } | |
| 11030 | |||
| 11031 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11032 | { | ||
| 11033 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11034 | ✗ | return qe_invalid; | |
| 11035 | |||
| 11036 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&flip,f)) |
| 11037 | ✗ | return qe_invalid; | |
| 11038 | |||
| 11039 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&extend,f)) |
| 11040 | ✗ | return qe_invalid; | |
| 11041 | |||
| 11042 | 860 | setSprite(usingcanespr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11043 | 860 | } | |
| 11044 | |||
| 11045 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11046 | { | ||
| 11047 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11048 | ✗ | return qe_invalid; | |
| 11049 | |||
| 11050 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 11051 | ✗ | return qe_invalid; | |
| 11052 | |||
| 11053 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 11054 | ✗ | return qe_invalid; | |
| 11055 | |||
| 11056 | 860 | setSprite(pushingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11057 | 860 | } | |
| 11058 | |||
| 11059 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11060 | { | ||
| 11061 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11062 | ✗ | return qe_invalid; | |
| 11063 | |||
| 11064 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&flip,f)) |
| 11065 | ✗ | return qe_invalid; | |
| 11066 | |||
| 11067 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&extend,f)) |
| 11068 | ✗ | return qe_invalid; | |
| 11069 | |||
| 11070 | 860 | byte frames = 0; | |
| 11071 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 840 times.
|
860 | if(v_herosprites > 15) |
| 11072 | { | ||
| 11073 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 840 times.
|
840 | if(!p_getc(&frames,f)) |
| 11074 | ✗ | return qe_invalid; | |
| 11075 | 840 | } | |
| 11076 | |||
| 11077 | 860 | setSprite(liftingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11078 | 860 | liftingspr[q][spr_frames] = frames; | |
| 11079 | 860 | } | |
| 11080 | |||
| 11081 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11082 | { | ||
| 11083 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11084 | ✗ | return qe_invalid; | |
| 11085 | |||
| 11086 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&flip,f)) |
| 11087 | ✗ | return qe_invalid; | |
| 11088 | |||
| 11089 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&extend,f)) |
| 11090 | ✗ | return qe_invalid; | |
| 11091 | |||
| 11092 | 860 | setSprite(liftingwalkspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11093 | 860 | } | |
| 11094 | |||
| 11095 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11096 | { | ||
| 11097 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_igetl(&tile,f)) |
| 11098 | ✗ | return qe_invalid; | |
| 11099 | |||
| 11100 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&flip,f)) |
| 11101 | ✗ | return qe_invalid; | |
| 11102 | |||
| 11103 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 11104 | ✗ | return qe_invalid; | |
| 11105 | |||
| 11106 | 860 | setSprite(stunnedspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11107 | 860 | } | |
| 11108 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11109 | { | ||
| 11110 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11111 | ✗ | return qe_invalid; | |
| 11112 | |||
| 11113 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&flip,f)) |
| 11114 | ✗ | return qe_invalid; | |
| 11115 | |||
| 11116 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&extend,f)) |
| 11117 | ✗ | return qe_invalid; | |
| 11118 | |||
| 11119 | 860 | setSprite(stunned_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11120 | 860 | } | |
| 11121 | |||
| 11122 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11123 | { | ||
| 11124 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11125 | ✗ | return qe_invalid; | |
| 11126 | |||
| 11127 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&flip,f)) |
| 11128 | ✗ | return qe_invalid; | |
| 11129 | |||
| 11130 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 11131 | ✗ | return qe_invalid; | |
| 11132 | |||
| 11133 | 860 | setSprite(drowningspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11134 | 860 | } | |
| 11135 | |||
| 11136 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11137 | { | ||
| 11138 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11139 | ✗ | return qe_invalid; | |
| 11140 | |||
| 11141 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&flip,f)) |
| 11142 | ✗ | return qe_invalid; | |
| 11143 | |||
| 11144 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&extend,f)) |
| 11145 | ✗ | return qe_invalid; | |
| 11146 | |||
| 11147 | 860 | setSprite(drowning_lavaspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11148 | 860 | } | |
| 11149 | |||
| 11150 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11151 | { | ||
| 11152 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11153 | ✗ | return qe_invalid; | |
| 11154 | |||
| 11155 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&flip,f)) |
| 11156 | ✗ | return qe_invalid; | |
| 11157 | |||
| 11158 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&extend,f)) |
| 11159 | ✗ | return qe_invalid; | |
| 11160 | |||
| 11161 | 860 | setSprite(fallingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11162 | 860 | } | |
| 11163 | |||
| 11164 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11165 | { | ||
| 11166 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11167 | ✗ | return qe_invalid; | |
| 11168 | |||
| 11169 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&flip,f)) |
| 11170 | ✗ | return qe_invalid; | |
| 11171 | |||
| 11172 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&extend,f)) |
| 11173 | ✗ | return qe_invalid; | |
| 11174 | |||
| 11175 | 860 | setSprite(shockedspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11176 | 860 | } | |
| 11177 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11178 | { | ||
| 11179 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11180 | ✗ | return qe_invalid; | |
| 11181 | |||
| 11182 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&flip,f)) |
| 11183 | ✗ | return qe_invalid; | |
| 11184 | |||
| 11185 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&extend,f)) |
| 11186 | ✗ | return qe_invalid; | |
| 11187 | |||
| 11188 | 860 | setSprite(shocked_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11189 | 860 | } | |
| 11190 | |||
| 11191 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11192 | { | ||
| 11193 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11194 | ✗ | return qe_invalid; | |
| 11195 | |||
| 11196 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 11197 | ✗ | return qe_invalid; | |
| 11198 | |||
| 11199 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 11200 | ✗ | return qe_invalid; | |
| 11201 | |||
| 11202 | 860 | setSprite(pullswordspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11203 | 860 | } | |
| 11204 | |||
| 11205 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11206 | { | ||
| 11207 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11208 | ✗ | return qe_invalid; | |
| 11209 | |||
| 11210 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&flip,f)) |
| 11211 | ✗ | return qe_invalid; | |
| 11212 | |||
| 11213 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&extend,f)) |
| 11214 | ✗ | return qe_invalid; | |
| 11215 | |||
| 11216 | 860 | setSprite(readingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11217 | 860 | } | |
| 11218 | |||
| 11219 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11220 | { | ||
| 11221 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_igetl(&tile,f)) |
| 11222 | ✗ | return qe_invalid; | |
| 11223 | |||
| 11224 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&flip,f)) |
| 11225 | ✗ | return qe_invalid; | |
| 11226 | |||
| 11227 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 11228 | ✗ | return qe_invalid; | |
| 11229 | |||
| 11230 | 860 | setSprite(slash180spr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11231 | 860 | } | |
| 11232 | |||
| 11233 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11234 | { | ||
| 11235 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11236 | ✗ | return qe_invalid; | |
| 11237 | |||
| 11238 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&flip,f)) |
| 11239 | ✗ | return qe_invalid; | |
| 11240 | |||
| 11241 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&extend,f)) |
| 11242 | ✗ | return qe_invalid; | |
| 11243 | |||
| 11244 | 860 | setSprite(slashZ4spr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11245 | 860 | } | |
| 11246 | |||
| 11247 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11248 | { | ||
| 11249 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11250 | ✗ | return qe_invalid; | |
| 11251 | |||
| 11252 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&flip,f)) |
| 11253 | ✗ | return qe_invalid; | |
| 11254 | |||
| 11255 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&extend,f)) |
| 11256 | ✗ | return qe_invalid; | |
| 11257 | |||
| 11258 | 860 | setSprite(dashspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11259 | 860 | } | |
| 11260 | |||
| 11261 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11262 | { | ||
| 11263 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11264 | ✗ | return qe_invalid; | |
| 11265 | |||
| 11266 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&flip,f)) |
| 11267 | ✗ | return qe_invalid; | |
| 11268 | |||
| 11269 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_getc(&extend,f)) |
| 11270 | ✗ | return qe_invalid; | |
| 11271 | |||
| 11272 | 860 | setSprite(bonkspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11273 | 860 | } | |
| 11274 | |||
| 11275 |
2/2✓ Branch 0 taken 645 times.
✓ Branch 1 taken 215 times.
|
860 | for(int32_t q = 0; q < 3; ++q) //Not directions; number of medallion sprs |
| 11276 | { | ||
| 11277 |
1/2✓ Branch 0 taken 645 times.
✗ Branch 1 not taken.
|
645 | if(!p_igetl(&tile,f)) |
| 11278 | ✗ | return qe_invalid; | |
| 11279 | |||
| 11280 |
1/2✓ Branch 0 taken 645 times.
✗ Branch 1 not taken.
|
645 | if(!p_getc(&flip,f)) |
| 11281 | ✗ | return qe_invalid; | |
| 11282 | |||
| 11283 |
1/2✓ Branch 0 taken 645 times.
✗ Branch 1 not taken.
|
645 | if(!p_getc(&extend,f)) |
| 11284 | ✗ | return qe_invalid; | |
| 11285 | |||
| 11286 | 645 | setSprite(medallionsprs[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11287 | 645 | } | |
| 11288 | 215 | } | |
| 11289 | else | ||
| 11290 | { | ||
| 11291 | ✗ | memset(frozenspr, 0, sizeof(frozenspr)); | |
| 11292 | ✗ | memset(frozen_waterspr, 0, sizeof(frozen_waterspr)); | |
| 11293 | ✗ | memset(onfirespr, 0, sizeof(onfirespr)); | |
| 11294 | ✗ | memset(onfire_waterspr, 0, sizeof(onfire_waterspr)); | |
| 11295 | ✗ | memset(diggingspr, 0, sizeof(diggingspr)); | |
| 11296 | ✗ | memset(usingrodspr, 0, sizeof(usingrodspr)); | |
| 11297 | ✗ | memset(usingcanespr, 0, sizeof(usingcanespr)); | |
| 11298 | ✗ | memset(pushingspr, 0, sizeof(pushingspr)); | |
| 11299 | ✗ | memset(liftingspr, 0, sizeof(liftingspr)); | |
| 11300 | ✗ | memset(liftingwalkspr, 0, sizeof(liftingwalkspr)); | |
| 11301 | ✗ | memset(stunnedspr, 0, sizeof(stunnedspr)); | |
| 11302 | ✗ | memset(stunned_waterspr, 0, sizeof(stunned_waterspr)); | |
| 11303 | ✗ | memset(fallingspr, 0, sizeof(fallingspr)); | |
| 11304 | ✗ | memset(shockedspr, 0, sizeof(shockedspr)); | |
| 11305 | ✗ | memset(shocked_waterspr, 0, sizeof(shocked_waterspr)); | |
| 11306 | ✗ | memset(pullswordspr, 0, sizeof(pullswordspr)); | |
| 11307 | ✗ | memset(readingspr, 0, sizeof(readingspr)); | |
| 11308 | ✗ | memset(slash180spr, 0, sizeof(slash180spr)); | |
| 11309 | ✗ | memset(slashZ4spr, 0, sizeof(slashZ4spr)); | |
| 11310 | ✗ | memset(dashspr, 0, sizeof(dashspr)); | |
| 11311 | ✗ | memset(bonkspr, 0, sizeof(bonkspr)); | |
| 11312 | ✗ | memset(medallionsprs, 0, sizeof(medallionsprs)); | |
| 11313 | ✗ | memset(holdspr[0][2], 0, sizeof(holdspr[0][2])); //Sword hold (Land) | |
| 11314 | ✗ | memset(holdspr[1][2], 0, sizeof(holdspr[1][2])); //Sword hold (Water) | |
| 11315 | ✗ | for(int32_t q = 0; q < 4; ++q) | |
| 11316 | { | ||
| 11317 | ✗ | for(int32_t p = 0; p < 3; ++p) | |
| 11318 | { | ||
| 11319 | ✗ | drowningspr[q][p] = divespr[q][p]; | |
| 11320 | ✗ | drowning_lavaspr[q][p] = divespr[q][p]; | |
| 11321 | ✗ | } | |
| 11322 | ✗ | } | |
| 11323 | } | ||
| 11324 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if (v_herosprites > 8) |
| 11325 | { | ||
| 11326 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11327 | { | ||
| 11328 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11329 | ✗ | return qe_invalid; | |
| 11330 | |||
| 11331 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 11332 | ✗ | return qe_invalid; | |
| 11333 | |||
| 11334 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 11335 | ✗ | return qe_invalid; | |
| 11336 | |||
| 11337 | 860 | setSprite(sideswimspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11338 | 860 | } | |
| 11339 | 215 | } | |
| 11340 | else | ||
| 11341 | { | ||
| 11342 | ✗ | memset(sideswimspr, 0, sizeof(sideswimspr)); | |
| 11343 | } | ||
| 11344 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if (v_herosprites > 9) |
| 11345 | { | ||
| 11346 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11347 | { | ||
| 11348 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11349 | ✗ | return qe_invalid; | |
| 11350 | |||
| 11351 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 11352 | ✗ | return qe_invalid; | |
| 11353 | |||
| 11354 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 11355 | ✗ | return qe_invalid; | |
| 11356 | |||
| 11357 | 860 | setSprite(sideswimslashspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11358 | 860 | } | |
| 11359 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11360 | { | ||
| 11361 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11362 | ✗ | return qe_invalid; | |
| 11363 | |||
| 11364 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 11365 | ✗ | return qe_invalid; | |
| 11366 | |||
| 11367 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 11368 | ✗ | return qe_invalid; | |
| 11369 | |||
| 11370 | 860 | setSprite(sideswimstabspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11371 | 860 | } | |
| 11372 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11373 | { | ||
| 11374 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11375 | ✗ | return qe_invalid; | |
| 11376 | |||
| 11377 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 11378 | ✗ | return qe_invalid; | |
| 11379 | |||
| 11380 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 11381 | ✗ | return qe_invalid; | |
| 11382 | |||
| 11383 | 860 | setSprite(sideswimpoundspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11384 | 860 | } | |
| 11385 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11386 | { | ||
| 11387 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11388 | ✗ | return qe_invalid; | |
| 11389 | |||
| 11390 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 11391 | ✗ | return qe_invalid; | |
| 11392 | |||
| 11393 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 11394 | ✗ | return qe_invalid; | |
| 11395 | |||
| 11396 | 860 | setSprite(sideswimchargespr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11397 | 860 | } | |
| 11398 | 215 | } | |
| 11399 | else | ||
| 11400 | { | ||
| 11401 | ✗ | memset(sideswimslashspr, 0, sizeof(sideswimslashspr)); | |
| 11402 | ✗ | memset(sideswimstabspr, 0, sizeof(sideswimstabspr)); | |
| 11403 | ✗ | memset(sideswimpoundspr, 0, sizeof(sideswimpoundspr)); | |
| 11404 | ✗ | memset(sideswimchargespr, 0, sizeof(sideswimchargespr)); | |
| 11405 | } | ||
| 11406 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if (v_herosprites > 10) |
| 11407 | { | ||
| 11408 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11409 | { | ||
| 11410 | int32_t hmr; | ||
| 11411 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_igetl(&hmr,f)) |
| 11412 | ✗ | return qe_invalid; | |
| 11413 | |||
| 11414 | 860 | hammeroffsets[q] = hmr; | |
| 11415 | 860 | } | |
| 11416 | 215 | } | |
| 11417 | else | ||
| 11418 | { | ||
| 11419 | ✗ | for(int32_t q = 0; q < 4; ++q) hammeroffsets[q] = 0; | |
| 11420 | } | ||
| 11421 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if (v_herosprites > 11) |
| 11422 | { | ||
| 11423 |
2/2✓ Branch 0 taken 645 times.
✓ Branch 1 taken 215 times.
|
860 | for(int32_t q = 0; q < 3; ++q) |
| 11424 | { | ||
| 11425 |
1/2✓ Branch 0 taken 645 times.
✗ Branch 1 not taken.
|
645 | if(!p_igetl(&tile,f)) |
| 11426 | ✗ | return qe_invalid; | |
| 11427 | |||
| 11428 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 645 times.
|
645 | if(!p_getc(&flip,f)) |
| 11429 | ✗ | return qe_invalid; | |
| 11430 | |||
| 11431 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 645 times.
|
645 | if(!p_getc(&extend,f)) |
| 11432 | ✗ | return qe_invalid; | |
| 11433 | |||
| 11434 | 645 | setSprite(sideswimholdspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11435 | 645 | } | |
| 11436 | 215 | } | |
| 11437 | else | ||
| 11438 | { | ||
| 11439 | ✗ | memset(sideswimholdspr, 0, sizeof(sideswimholdspr)); | |
| 11440 | } | ||
| 11441 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if (v_herosprites > 12) |
| 11442 | { | ||
| 11443 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if(!p_igetl(&tile,f)) |
| 11444 | ✗ | return qe_invalid; | |
| 11445 | |||
| 11446 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if(!p_getc(&flip,f)) |
| 11447 | ✗ | return qe_invalid; | |
| 11448 | |||
| 11449 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if(!p_getc(&extend,f)) |
| 11450 | ✗ | return qe_invalid; | |
| 11451 | 215 | setSprite(sideswimcastingspr, int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11452 | |||
| 11453 | 215 | } | |
| 11454 | else | ||
| 11455 | { | ||
| 11456 | ✗ | memset(sideswimcastingspr, 0, sizeof(sideswimcastingspr)); | |
| 11457 | } | ||
| 11458 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if (v_herosprites > 13) |
| 11459 | { | ||
| 11460 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11461 | { | ||
| 11462 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11463 | ✗ | return qe_invalid; | |
| 11464 | |||
| 11465 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 11466 | ✗ | return qe_invalid; | |
| 11467 | |||
| 11468 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 11469 | ✗ | return qe_invalid; | |
| 11470 | |||
| 11471 | 860 | setSprite(sidedrowningspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11472 | 860 | } | |
| 11473 | 215 | } | |
| 11474 | else | ||
| 11475 | { | ||
| 11476 | ✗ | memset(sidedrowningspr, 0, sizeof(sidedrowningspr)); | |
| 11477 | } | ||
| 11478 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if (v_herosprites > 14) |
| 11479 | { | ||
| 11480 |
2/2✓ Branch 0 taken 860 times.
✓ Branch 1 taken 215 times.
|
1075 | for(int32_t q = 0; q < 4; ++q) |
| 11481 | { | ||
| 11482 |
1/2✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
|
860 | if(!p_igetl(&tile,f)) |
| 11483 | ✗ | return qe_invalid; | |
| 11484 | |||
| 11485 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&flip,f)) |
| 11486 | ✗ | return qe_invalid; | |
| 11487 | |||
| 11488 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
|
860 | if(!p_getc(&extend,f)) |
| 11489 | ✗ | return qe_invalid; | |
| 11490 | |||
| 11491 | 860 | setSprite(revslashspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11492 | 860 | } | |
| 11493 | 215 | } | |
| 11494 | else | ||
| 11495 | { | ||
| 11496 | ✗ | memset(revslashspr, 0, sizeof(revslashspr)); | |
| 11497 | } | ||
| 11498 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if (v_herosprites > 7) |
| 11499 | { | ||
| 11500 | 215 | int32_t num_defense = wMax; | |
| 11501 | 215 | byte def = 0; | |
| 11502 | |||
| 11503 | //Set num_defense accordingly if changes to enum require version upgrade - Jman | ||
| 11504 | /*if(v_herosprites > [x]) | ||
| 11505 | * { | ||
| 11506 | * num_defense = 146 //value of wMax on version 8 | ||
| 11507 | * } | ||
| 11508 | */ | ||
| 11509 | |||
| 11510 |
2/2✓ Branch 0 taken 31390 times.
✓ Branch 1 taken 215 times.
|
31605 | for (int32_t q = 0; q < num_defense; q++) |
| 11511 | { | ||
| 11512 |
1/2✓ Branch 0 taken 31390 times.
✗ Branch 1 not taken.
|
31390 | if (!p_getc(&def, f)) |
| 11513 | ✗ | return qe_invalid; | |
| 11514 | |||
| 11515 | 31390 | hero_defenses[q] = def; | |
| 11516 | 31390 | } | |
| 11517 | 215 | } | |
| 11518 | else | ||
| 11519 | { | ||
| 11520 | ✗ | int32_t num_defense = wMax; | |
| 11521 | ✗ | for (int32_t q = 0; q < num_defense; q++) | |
| 11522 | { | ||
| 11523 | ✗ | hero_defenses[q] = 0; | |
| 11524 | ✗ | } | |
| 11525 | } | ||
| 11526 | 215 | } | |
| 11527 | |||
| 11528 |
2/2✓ Branch 0 taken 204 times.
✓ Branch 1 taken 11 times.
|
215 | if(FFCore.quest_format[vInitData] < 34) |
| 11529 | { | ||
| 11530 | 11 | bool fastswim = zinit.hero_swim_speed > 60; | |
| 11531 | // '2/3' or '1/2' | ||
| 11532 | 11 | zinit.hero_swim_mult = fastswim ? 2 : 1; | |
| 11533 | 11 | zinit.hero_swim_div = fastswim ? 3 : 2; | |
| 11534 | 11 | } | |
| 11535 | 215 | return 0; | |
| 11536 | 215 | } | |
| 11537 | |||
| 11538 | |||
| 11539 | 415 | int32_t readherosprites(PACKFILE *f, zquestheader *Header) | |
| 11540 | { | ||
| 11541 | //these are here to bypass compiler warnings about unused arguments | ||
| 11542 | 415 | Header=Header; | |
| 11543 | |||
| 11544 | dword dummy; | ||
| 11545 | 415 | word s_version=0; | |
| 11546 | |||
| 11547 | //section version info | ||
| 11548 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if(!p_igetw(&s_version,f)) |
| 11549 | { | ||
| 11550 | ✗ | return qe_invalid; | |
| 11551 | } | ||
| 11552 | |||
| 11553 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if (s_version > V_HEROSPRITES) |
| 11554 | ✗ | return qe_version; | |
| 11555 | |||
| 11556 | 415 | FFCore.quest_format[vHeroSprites] = s_version; | |
| 11557 | |||
| 11558 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(!read_deprecated_section_cversion(f)) |
| 11559 | { | ||
| 11560 | ✗ | return qe_invalid; | |
| 11561 | } | ||
| 11562 | |||
| 11563 | //section size | ||
| 11564 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(!p_igetl(&dummy,f)) |
| 11565 | { | ||
| 11566 | ✗ | return qe_invalid; | |
| 11567 | } | ||
| 11568 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 200 times.
|
415 | if ( s_version >= 6 ) |
| 11569 | { | ||
| 11570 | 215 | return readherosprites3(f, s_version); | |
| 11571 | } | ||
| 11572 | 200 | else return readherosprites2(f, s_version); | |
| 11573 | 415 | } | |
| 11574 | |||
| 11575 | 217 | int32_t read_old_subscreens(PACKFILE *f, word s_version) | |
| 11576 | { | ||
| 11577 | 217 | subscreens_active.clear(); | |
| 11578 | 217 | subscreens_passive.clear(); | |
| 11579 | 217 | subscreens_overlay.clear(); | |
| 11580 | 217 | subscreens_map.clear(); | |
| 11581 |
2/2✓ Branch 0 taken 27776 times.
✓ Branch 1 taken 217 times.
|
27993 | for(int32_t i=0; i<OLD_MAXCUSTOMSUBSCREENS; i++) |
| 11582 | { | ||
| 11583 | subscreen_group g; | ||
| 11584 | 27776 | memset(&g,0,sizeof(subscreen_group)); | |
| 11585 | 27776 | int32_t ret = read_one_old_subscreen(f, &g, s_version); | |
| 11586 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27776 times.
|
27776 | if(ret!=0) |
| 11587 | ✗ | return ret; | |
| 11588 |
2/2✓ Branch 0 taken 1117 times.
✓ Branch 1 taken 26659 times.
|
27776 | if(g.objects[0].type == ssoNULL) continue; |
| 11589 |
2/2✓ Branch 0 taken 467 times.
✓ Branch 1 taken 650 times.
|
1117 | auto& vec = g.ss_type == sstPASSIVE ? subscreens_passive : subscreens_active; |
| 11590 | 1117 | ZCSubscreen& sub = vec.emplace_back(); | |
| 11591 | 1117 | sub.load_old(g); | |
| 11592 | 1117 | } | |
| 11593 | |||
| 11594 | 217 | return 0; | |
| 11595 | 217 | } | |
| 11596 | |||
| 11597 | 27776 | int32_t read_one_old_subscreen(PACKFILE *f, subscreen_group* g, word s_version) | |
| 11598 | { | ||
| 11599 | 27776 | int32_t numsub=0; | |
| 11600 | 27776 | byte temp_ss=0; | |
| 11601 | subscreen_object temp_sub_stack; | ||
| 11602 | 27776 | subscreen_object *temp_sub = &temp_sub_stack; | |
| 11603 | |||
| 11604 | char tempname[64]; | ||
| 11605 | |||
| 11606 | // FWIW I never saw anything bigger than 20. | ||
| 11607 | #define MAX_DP1_LEN 1024 | ||
| 11608 | char tempdp1[MAX_DP1_LEN]; | ||
| 11609 | |||
| 11610 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27776 times.
|
27776 | if(!pfread(tempname,64,f)) |
| 11611 | { | ||
| 11612 | ✗ | return qe_invalid; | |
| 11613 | } | ||
| 11614 | |||
| 11615 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27776 times.
|
27776 | if(s_version > 1) |
| 11616 | { | ||
| 11617 |
1/2✓ Branch 0 taken 27776 times.
✗ Branch 1 not taken.
|
27776 | if(!p_getc(&temp_ss,f)) |
| 11618 | { | ||
| 11619 | ✗ | return qe_invalid; | |
| 11620 | } | ||
| 11621 | 27776 | } | |
| 11622 | |||
| 11623 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27776 times.
|
27776 | if(s_version < 4) |
| 11624 | { | ||
| 11625 | ✗ | uint8_t tmp=0; | |
| 11626 | |||
| 11627 | ✗ | if(!p_getc(&tmp,f)) | |
| 11628 | { | ||
| 11629 | ✗ | return qe_invalid; | |
| 11630 | } | ||
| 11631 | |||
| 11632 | ✗ | numsub = (int32_t)tmp; | |
| 11633 | ✗ | } | |
| 11634 | else | ||
| 11635 | { | ||
| 11636 | word tmp; | ||
| 11637 | |||
| 11638 |
1/2✓ Branch 0 taken 27776 times.
✗ Branch 1 not taken.
|
27776 | if(!p_igetw(&tmp, f)) |
| 11639 | { | ||
| 11640 | ✗ | return qe_invalid; | |
| 11641 | } | ||
| 11642 | |||
| 11643 | 27776 | numsub = (int32_t)tmp; | |
| 11644 | } | ||
| 11645 | |||
| 11646 | int32_t j; | ||
| 11647 | |||
| 11648 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 71950 times.
✓ Branch 2 taken 44174 times.
✓ Branch 3 taken 27776 times.
|
71950 | for(j=0; (j<OLD_MAXSUBSCREENITEMS&&j<numsub); j++) |
| 11649 | { | ||
| 11650 | 44174 | memset(temp_sub,0,sizeof(subscreen_object)); | |
| 11651 | |||
| 11652 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44174 times.
|
44174 | switch(g->objects[j].type) |
| 11653 | { | ||
| 11654 | case ssoTEXT: | ||
| 11655 | case ssoTEXTBOX: | ||
| 11656 | case ssoCURRENTITEMTEXT: | ||
| 11657 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11658 | ✗ | if(g->objects[j].dp1 != NULL) delete [](char *)g->objects[j].dp1; | |
| 11659 | |||
| 11660 | //fall through | ||
| 11661 | default: | ||
| 11662 | 44174 | memset(&g->objects[j],0,sizeof(subscreen_object)); | |
| 11663 | 44174 | break; | |
| 11664 | } | ||
| 11665 | |||
| 11666 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_getc(&(temp_sub->type),f)) |
| 11667 | ✗ | return qe_invalid; | |
| 11668 | |||
| 11669 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_getc(&(temp_sub->pos),f)) |
| 11670 | ✗ | return qe_invalid; | |
| 11671 | |||
| 11672 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(s_version < 5) |
| 11673 | { | ||
| 11674 | ✗ | switch(temp_sub->pos) | |
| 11675 | { | ||
| 11676 | case 0: | ||
| 11677 | ✗ | temp_sub->pos = sspUP | sspDOWN | sspSCROLLING; | |
| 11678 | ✗ | break; | |
| 11679 | |||
| 11680 | case 1: | ||
| 11681 | ✗ | temp_sub->pos = sspUP; | |
| 11682 | ✗ | break; | |
| 11683 | |||
| 11684 | case 2: | ||
| 11685 | ✗ | temp_sub->pos = sspDOWN; | |
| 11686 | ✗ | break; | |
| 11687 | |||
| 11688 | default: | ||
| 11689 | ✗ | temp_sub->pos = 0; | |
| 11690 | ✗ | } | |
| 11691 | ✗ | } | |
| 11692 | |||
| 11693 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_igetw(&(temp_sub->x),f)) |
| 11694 | ✗ | return qe_invalid; | |
| 11695 | |||
| 11696 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_igetw(&(temp_sub->y),f)) |
| 11697 | ✗ | return qe_invalid; | |
| 11698 | |||
| 11699 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_igetw(&(temp_sub->w),f)) |
| 11700 | ✗ | return qe_invalid; | |
| 11701 | |||
| 11702 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_igetw(&(temp_sub->h),f)) |
| 11703 | ✗ | return qe_invalid; | |
| 11704 | |||
| 11705 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_getc(&(temp_sub->colortype1),f)) |
| 11706 | ✗ | return qe_invalid; | |
| 11707 | |||
| 11708 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_igetw(&(temp_sub->color1),f)) |
| 11709 | ✗ | return qe_invalid; | |
| 11710 | |||
| 11711 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_getc(&(temp_sub->colortype2),f)) |
| 11712 | ✗ | return qe_invalid; | |
| 11713 | |||
| 11714 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_igetw(&(temp_sub->color2),f)) |
| 11715 | ✗ | return qe_invalid; | |
| 11716 | |||
| 11717 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_getc(&(temp_sub->colortype3),f)) |
| 11718 | ✗ | return qe_invalid; | |
| 11719 | |||
| 11720 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_igetw(&(temp_sub->color3),f)) |
| 11721 | ✗ | return qe_invalid; | |
| 11722 | |||
| 11723 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_igetd(&(temp_sub->d1),f)) |
| 11724 | ✗ | return qe_invalid; | |
| 11725 | |||
| 11726 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_igetd(&(temp_sub->d2),f)) |
| 11727 | ✗ | return qe_invalid; | |
| 11728 | |||
| 11729 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_igetd(&(temp_sub->d3),f)) |
| 11730 | ✗ | return qe_invalid; | |
| 11731 | |||
| 11732 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_igetd(&(temp_sub->d4),f)) |
| 11733 | ✗ | return qe_invalid; | |
| 11734 | |||
| 11735 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_igetd(&(temp_sub->d5),f)) |
| 11736 | ✗ | return qe_invalid; | |
| 11737 | |||
| 11738 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_igetd(&(temp_sub->d6),f)) |
| 11739 | ✗ | return qe_invalid; | |
| 11740 | |||
| 11741 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_igetd(&(temp_sub->d7),f)) |
| 11742 | ✗ | return qe_invalid; | |
| 11743 | |||
| 11744 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_igetd(&(temp_sub->d8),f)) |
| 11745 | ✗ | return qe_invalid; | |
| 11746 | |||
| 11747 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_igetd(&(temp_sub->d9),f)) |
| 11748 | ✗ | return qe_invalid; | |
| 11749 | |||
| 11750 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_igetd(&(temp_sub->d10),f)) |
| 11751 | ✗ | return qe_invalid; | |
| 11752 | |||
| 11753 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44174 times.
|
44174 | if(s_version < 2) |
| 11754 | { | ||
| 11755 | ✗ | if(!p_igetl(&(temp_sub->speed),f)) | |
| 11756 | ✗ | return qe_invalid; | |
| 11757 | |||
| 11758 | ✗ | if(!p_igetl(&(temp_sub->delay),f)) | |
| 11759 | ✗ | return qe_invalid; | |
| 11760 | |||
| 11761 | ✗ | if(!p_igetl(&(temp_sub->frame),f)) | |
| 11762 | ✗ | return qe_invalid; | |
| 11763 | ✗ | } | |
| 11764 | else | ||
| 11765 | { | ||
| 11766 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_getc(&(temp_sub->speed),f)) |
| 11767 | ✗ | return qe_invalid; | |
| 11768 | |||
| 11769 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_getc(&(temp_sub->delay),f)) |
| 11770 | ✗ | return qe_invalid; | |
| 11771 | |||
| 11772 |
1/2✓ Branch 0 taken 44174 times.
✗ Branch 1 not taken.
|
44174 | if(!p_igetw(&(temp_sub->frame),f)) |
| 11773 | ✗ | return qe_invalid; | |
| 11774 | } | ||
| 11775 | |||
| 11776 | 44174 | int32_t temp_size=0; | |
| 11777 | |||
| 11778 | // bool deletets = false; | ||
| 11779 |
4/4✓ Branch 0 taken 19541 times.
✓ Branch 1 taken 3389 times.
✓ Branch 2 taken 21002 times.
✓ Branch 3 taken 242 times.
|
44174 | switch(temp_sub->type) |
| 11780 | { | ||
| 11781 | case ssoTEXT: | ||
| 11782 | case ssoTEXTBOX: | ||
| 11783 | case ssoCURRENTITEMTEXT: | ||
| 11784 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11785 | { | ||
| 11786 | word temptempsize; | ||
| 11787 | |||
| 11788 |
1/2✓ Branch 0 taken 3389 times.
✗ Branch 1 not taken.
|
3389 | if(!p_igetw(&temptempsize,f)) |
| 11789 | { | ||
| 11790 | ✗ | return qe_invalid; | |
| 11791 | } | ||
| 11792 | |||
| 11793 | //temptempsize = temp1 + (temp2 << 8); | ||
| 11794 | 3389 | temp_size = (int32_t)temptempsize; | |
| 11795 | 3389 | uint32_t char_length = temp_size+2; | |
| 11796 |
1/2✓ Branch 0 taken 3389 times.
✗ Branch 1 not taken.
|
3389 | if (char_length > MAX_DP1_LEN) |
| 11797 | { | ||
| 11798 | ✗ | return qe_invalid; | |
| 11799 | } | ||
| 11800 | 3389 | tempdp1[char_length - 1] = '\0'; | |
| 11801 | |||
| 11802 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3389 times.
|
3389 | if(temp_size) |
| 11803 |
1/2✓ Branch 0 taken 3389 times.
✗ Branch 1 not taken.
|
3389 | if(!pfread(tempdp1,temp_size+1,f)) |
| 11804 | ✗ | return qe_invalid; | |
| 11805 | 3389 | break; | |
| 11806 | } | ||
| 11807 | |||
| 11808 | case ssoLIFEMETER: | ||
| 11809 |
1/2✓ Branch 0 taken 242 times.
✗ Branch 1 not taken.
|
242 | if(get_bit(deprecated_rules, 12) != 0) // qr_24HC |
| 11810 | ✗ | temp_sub->d3 = 1; | |
| 11811 | |||
| 11812 |
1/2✓ Branch 0 taken 242 times.
✗ Branch 1 not taken.
|
242 | if(!p_getc(&(temp_sub->dp1),f)) |
| 11813 | ✗ | return qe_invalid; | |
| 11814 | |||
| 11815 | 242 | break; | |
| 11816 | |||
| 11817 | |||
| 11818 | case ssoCURRENTITEM: | ||
| 11819 | |||
| 11820 |
1/2✓ Branch 0 taken 19541 times.
✗ Branch 1 not taken.
|
19541 | if(s_version < 6) |
| 11821 | { | ||
| 11822 | ✗ | switch(temp_sub->d1) | |
| 11823 | { | ||
| 11824 | case ssiBOMB: | ||
| 11825 | ✗ | temp_sub->d1 = itype_bomb; | |
| 11826 | ✗ | break; | |
| 11827 | |||
| 11828 | case ssiSWORD: | ||
| 11829 | ✗ | temp_sub->d1 = itype_sword; | |
| 11830 | ✗ | break; | |
| 11831 | |||
| 11832 | case ssiSHIELD: | ||
| 11833 | ✗ | temp_sub->d1 = itype_shield; | |
| 11834 | ✗ | break; | |
| 11835 | |||
| 11836 | case ssiCANDLE: | ||
| 11837 | ✗ | temp_sub->d1 = itype_candle; | |
| 11838 | ✗ | break; | |
| 11839 | |||
| 11840 | case ssiLETTER: | ||
| 11841 | ✗ | temp_sub->d1 = itype_letter; | |
| 11842 | ✗ | break; | |
| 11843 | |||
| 11844 | case ssiPOTION: | ||
| 11845 | ✗ | temp_sub->d1 = itype_potion; | |
| 11846 | ✗ | break; | |
| 11847 | |||
| 11848 | case ssiLETTERPOTION: | ||
| 11849 | ✗ | temp_sub->d1 = itype_letterpotion; | |
| 11850 | ✗ | break; | |
| 11851 | |||
| 11852 | case ssiBOW: | ||
| 11853 | ✗ | temp_sub->d1 = itype_bow; | |
| 11854 | ✗ | break; | |
| 11855 | |||
| 11856 | case ssiARROW: | ||
| 11857 | ✗ | temp_sub->d1 = itype_arrow; | |
| 11858 | ✗ | break; | |
| 11859 | |||
| 11860 | case ssiBOWANDARROW: | ||
| 11861 | ✗ | temp_sub->d1 = itype_bowandarrow; | |
| 11862 | ✗ | break; | |
| 11863 | |||
| 11864 | case ssiBAIT: | ||
| 11865 | ✗ | temp_sub->d1 = itype_bait; | |
| 11866 | ✗ | break; | |
| 11867 | |||
| 11868 | case ssiRING: | ||
| 11869 | ✗ | temp_sub->d1 = itype_ring; | |
| 11870 | ✗ | break; | |
| 11871 | |||
| 11872 | case ssiBRACELET: | ||
| 11873 | ✗ | temp_sub->d1 = itype_bracelet; | |
| 11874 | ✗ | break; | |
| 11875 | |||
| 11876 | case ssiMAP: | ||
| 11877 | ✗ | temp_sub->d1 = itype_map; | |
| 11878 | ✗ | break; | |
| 11879 | |||
| 11880 | case ssiCOMPASS: | ||
| 11881 | ✗ | temp_sub->d1 = itype_compass; | |
| 11882 | ✗ | break; | |
| 11883 | |||
| 11884 | case ssiBOSSKEY: | ||
| 11885 | ✗ | temp_sub->d1 = itype_bosskey; | |
| 11886 | ✗ | break; | |
| 11887 | |||
| 11888 | case ssiMAGICKEY: | ||
| 11889 | ✗ | temp_sub->d1 = itype_magickey; | |
| 11890 | ✗ | break; | |
| 11891 | |||
| 11892 | case ssiBRANG: | ||
| 11893 | ✗ | temp_sub->d1 = itype_brang; | |
| 11894 | ✗ | break; | |
| 11895 | |||
| 11896 | case ssiWAND: | ||
| 11897 | ✗ | temp_sub->d1 = itype_wand; | |
| 11898 | ✗ | break; | |
| 11899 | |||
| 11900 | case ssiRAFT: | ||
| 11901 | ✗ | temp_sub->d1 = itype_raft; | |
| 11902 | ✗ | break; | |
| 11903 | |||
| 11904 | case ssiLADDER: | ||
| 11905 | ✗ | temp_sub->d1 = itype_ladder; | |
| 11906 | ✗ | break; | |
| 11907 | |||
| 11908 | case ssiWHISTLE: | ||
| 11909 | ✗ | temp_sub->d1 = itype_whistle; | |
| 11910 | ✗ | break; | |
| 11911 | |||
| 11912 | case ssiBOOK: | ||
| 11913 | ✗ | temp_sub->d1 = itype_book; | |
| 11914 | ✗ | break; | |
| 11915 | |||
| 11916 | case ssiWALLET: | ||
| 11917 | ✗ | temp_sub->d1 = itype_wallet; | |
| 11918 | ✗ | break; | |
| 11919 | |||
| 11920 | case ssiSBOMB: | ||
| 11921 | ✗ | temp_sub->d1 = itype_sbomb; | |
| 11922 | ✗ | break; | |
| 11923 | |||
| 11924 | case ssiHCPIECE: | ||
| 11925 | ✗ | temp_sub->d1 = itype_heartpiece; | |
| 11926 | ✗ | break; | |
| 11927 | |||
| 11928 | case ssiAMULET: | ||
| 11929 | ✗ | temp_sub->d1 = itype_amulet; | |
| 11930 | ✗ | break; | |
| 11931 | |||
| 11932 | case ssiFLIPPERS: | ||
| 11933 | ✗ | temp_sub->d1 = itype_flippers; | |
| 11934 | ✗ | break; | |
| 11935 | |||
| 11936 | case ssiHOOKSHOT: | ||
| 11937 | ✗ | temp_sub->d1 = itype_hookshot; | |
| 11938 | ✗ | break; | |
| 11939 | |||
| 11940 | case ssiLENS: | ||
| 11941 | ✗ | temp_sub->d1 = itype_lens; | |
| 11942 | ✗ | break; | |
| 11943 | |||
| 11944 | case ssiHAMMER: | ||
| 11945 | ✗ | temp_sub->d1 = itype_hammer; | |
| 11946 | ✗ | break; | |
| 11947 | |||
| 11948 | case ssiBOOTS: | ||
| 11949 | ✗ | temp_sub->d1 = itype_boots; | |
| 11950 | ✗ | break; | |
| 11951 | |||
| 11952 | case ssiDIVINEFIRE: | ||
| 11953 | ✗ | temp_sub->d1 = itype_divinefire; | |
| 11954 | ✗ | break; | |
| 11955 | |||
| 11956 | case ssiDIVINEESCAPE: | ||
| 11957 | ✗ | temp_sub->d1 = itype_divineescape; | |
| 11958 | ✗ | break; | |
| 11959 | |||
| 11960 | case ssiDIVINEPROTECTION: | ||
| 11961 | ✗ | temp_sub->d1 = itype_divineprotection; | |
| 11962 | ✗ | break; | |
| 11963 | |||
| 11964 | case ssiQUIVER: | ||
| 11965 | ✗ | temp_sub->d1 = itype_quiver; | |
| 11966 | ✗ | break; | |
| 11967 | |||
| 11968 | case ssiBOMBBAG: | ||
| 11969 | ✗ | temp_sub->d1 = itype_bombbag; | |
| 11970 | ✗ | break; | |
| 11971 | |||
| 11972 | case ssiCBYRNA: | ||
| 11973 | ✗ | temp_sub->d1 = itype_cbyrna; | |
| 11974 | ✗ | break; | |
| 11975 | |||
| 11976 | case ssiROCS: | ||
| 11977 | ✗ | temp_sub->d1 = itype_rocs; | |
| 11978 | ✗ | break; | |
| 11979 | |||
| 11980 | case ssiHOVERBOOTS: | ||
| 11981 | ✗ | temp_sub->d1 = itype_hoverboots; | |
| 11982 | ✗ | break; | |
| 11983 | |||
| 11984 | case ssiSPINSCROLL: | ||
| 11985 | ✗ | temp_sub->d1 = itype_spinscroll; | |
| 11986 | ✗ | break; | |
| 11987 | |||
| 11988 | case ssiCROSSSCROLL: | ||
| 11989 | ✗ | temp_sub->d1 = itype_crossscroll; | |
| 11990 | ✗ | break; | |
| 11991 | |||
| 11992 | case ssiQUAKESCROLL: | ||
| 11993 | ✗ | temp_sub->d1 = itype_quakescroll; | |
| 11994 | ✗ | break; | |
| 11995 | |||
| 11996 | case ssiWHISPRING: | ||
| 11997 | ✗ | temp_sub->d1 = itype_whispring; | |
| 11998 | ✗ | break; | |
| 11999 | |||
| 12000 | case ssiCHARGERING: | ||
| 12001 | ✗ | temp_sub->d1 = itype_chargering; | |
| 12002 | ✗ | break; | |
| 12003 | |||
| 12004 | case ssiPERILSCROLL: | ||
| 12005 | ✗ | temp_sub->d1 = itype_perilscroll; | |
| 12006 | ✗ | break; | |
| 12007 | |||
| 12008 | case ssiWEALTHMEDAL: | ||
| 12009 | ✗ | temp_sub->d1 = itype_wealthmedal; | |
| 12010 | ✗ | break; | |
| 12011 | |||
| 12012 | case ssiHEARTRING: | ||
| 12013 | ✗ | temp_sub->d1 = itype_heartring; | |
| 12014 | ✗ | break; | |
| 12015 | |||
| 12016 | case ssiMAGICRING: | ||
| 12017 | ✗ | temp_sub->d1 = itype_magicring; | |
| 12018 | ✗ | break; | |
| 12019 | |||
| 12020 | case ssiSPINSCROLL2: | ||
| 12021 | ✗ | temp_sub->d1 = itype_spinscroll2; | |
| 12022 | ✗ | break; | |
| 12023 | |||
| 12024 | case ssiQUAKESCROLL2: | ||
| 12025 | ✗ | temp_sub->d1 = itype_quakescroll2; | |
| 12026 | ✗ | break; | |
| 12027 | |||
| 12028 | case ssiAGONY: | ||
| 12029 | ✗ | temp_sub->d1 = itype_agony; | |
| 12030 | ✗ | break; | |
| 12031 | |||
| 12032 | case ssiSTOMPBOOTS: | ||
| 12033 | ✗ | temp_sub->d1 = itype_stompboots; | |
| 12034 | ✗ | break; | |
| 12035 | |||
| 12036 | case ssiWHIMSICALRING: | ||
| 12037 | ✗ | temp_sub->d1 = itype_whimsicalring; | |
| 12038 | ✗ | break; | |
| 12039 | |||
| 12040 | case ssiPERILRING: | ||
| 12041 | ✗ | temp_sub->d1 = itype_perilring; | |
| 12042 | ✗ | break; | |
| 12043 | |||
| 12044 | default: | ||
| 12045 | ✗ | temp_sub->d1 += itype_custom1 - ssiMAX; | |
| 12046 | ✗ | } | |
| 12047 | ✗ | } | |
| 12048 | |||
| 12049 | //fall-through | ||
| 12050 | default: | ||
| 12051 |
1/2✓ Branch 0 taken 40543 times.
✗ Branch 1 not taken.
|
40543 | if(!p_getc(&(temp_sub->dp1),f)) |
| 12052 | ✗ | return qe_invalid; | |
| 12053 | |||
| 12054 | 40543 | break; | |
| 12055 | } | ||
| 12056 | |||
| 12057 |
2/2✓ Branch 0 taken 8694 times.
✓ Branch 1 taken 35480 times.
|
44174 | if(s_version < 7) |
| 12058 | { | ||
| 12059 |
3/3✓ Branch 0 taken 29642 times.
✓ Branch 1 taken 1270 times.
✓ Branch 2 taken 4568 times.
|
35480 | switch(temp_sub->type) |
| 12060 | { | ||
| 12061 | case ssoMAGICGAUGE: | ||
| 12062 | { | ||
| 12063 |
2/2✓ Branch 0 taken 134 times.
✓ Branch 1 taken 1136 times.
|
1270 | if(!temp_sub->d9) |
| 12064 | 1136 | temp_sub->d9 = -1; //-1 now represents 'always' | |
| 12065 | 1270 | break; | |
| 12066 | } | ||
| 12067 | case ssoLIFEGAUGE: | ||
| 12068 | 4568 | temp_sub->d9 = 0; //Unused, doesn't do anything? Clear it... | |
| 12069 | 4568 | break; | |
| 12070 | } | ||
| 12071 | 35480 | } | |
| 12072 | |||
| 12073 |
3/3✓ Branch 0 taken 3389 times.
✓ Branch 1 taken 39307 times.
✓ Branch 2 taken 1478 times.
|
44174 | switch(temp_sub->type) |
| 12074 | { | ||
| 12075 | case ssoTEXT: | ||
| 12076 | case ssoTEXTBOX: | ||
| 12077 | case ssoCURRENTITEMTEXT: | ||
| 12078 | case ssoCURRENTITEMCLASSTEXT: | ||
| 12079 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3389 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3389 | if(g->objects[j].dp1 != NULL) delete[](char *)g->objects[j].dp1; |
| 12080 | |||
| 12081 | 3389 | memcpy(&g->objects[j],temp_sub,sizeof(subscreen_object)); | |
| 12082 | 3389 | g->objects[j].dp1 = new char[temp_size+2]; | |
| 12083 | 3389 | strcpy((char*)g->objects[j].dp1,tempdp1); | |
| 12084 | 3389 | break; | |
| 12085 | |||
| 12086 | case ssoCOUNTER: | ||
| 12087 |
1/2✓ Branch 0 taken 1478 times.
✗ Branch 1 not taken.
|
1478 | if(s_version<3) |
| 12088 | { | ||
| 12089 | ✗ | temp_sub->d6=(temp_sub->d6?1:0)+(temp_sub->d8?2:0); | |
| 12090 | ✗ | temp_sub->d8=0; | |
| 12091 | ✗ | } | |
| 12092 | |||
| 12093 | default: | ||
| 12094 | 40785 | memcpy(&g->objects[j],temp_sub,sizeof(subscreen_object)); | |
| 12095 | 40785 | break; | |
| 12096 | } | ||
| 12097 | |||
| 12098 | 44174 | g->name[0] = '\0'; | |
| 12099 | 44174 | strncat(g->name, tempname, 64 - 1); | |
| 12100 | 44174 | g->ss_type = temp_ss; | |
| 12101 | 44174 | } | |
| 12102 | |||
| 12103 |
2/2✓ Branch 0 taken 7066482 times.
✓ Branch 1 taken 27776 times.
|
7094258 | for(j=numsub; j<OLD_MAXSUBSCREENITEMS; j++) |
| 12104 | { | ||
| 12105 | //clear all unused object in this subscreen -DD | ||
| 12106 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7066482 times.
|
7066482 | switch(g->objects[j].type) |
| 12107 | { | ||
| 12108 | case ssoTEXT: | ||
| 12109 | case ssoTEXTBOX: | ||
| 12110 | case ssoCURRENTITEMTEXT: | ||
| 12111 | case ssoCURRENTITEMCLASSTEXT: | ||
| 12112 | ✗ | if(g->objects[j].dp1 != NULL) delete [](char *)g->objects[j].dp1; | |
| 12113 | |||
| 12114 | //fall through | ||
| 12115 | default: | ||
| 12116 | 7066482 | memset(&g->objects[j],0,sizeof(subscreen_object)); | |
| 12117 | 7066482 | break; | |
| 12118 | } | ||
| 12119 | 7066482 | } | |
| 12120 | |||
| 12121 | 27776 | return 0; | |
| 12122 | 27776 | } | |
| 12123 | |||
| 12124 | 415 | int32_t readsubscreens(PACKFILE *f) | |
| 12125 | { | ||
| 12126 | word s_version; | ||
| 12127 | dword dummy; | ||
| 12128 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if(!p_igetw(&s_version,f)) |
| 12129 | ✗ | return qe_invalid; | |
| 12130 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if (s_version > V_SUBSCREEN) |
| 12131 | ✗ | return qe_version; | |
| 12132 | 415 | FFCore.quest_format[vSubscreen] = s_version; | |
| 12133 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(!read_deprecated_section_cversion(f)) |
| 12134 | ✗ | return qe_invalid; | |
| 12135 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(!p_igetl(&dummy,f)) //section size |
| 12136 | ✗ | return qe_invalid; | |
| 12137 | |||
| 12138 |
2/2✓ Branch 0 taken 217 times.
✓ Branch 1 taken 198 times.
|
415 | if(s_version < 8) |
| 12139 | 217 | return read_old_subscreens(f,s_version); | |
| 12140 | |||
| 12141 | 198 | subscreens_active.clear(); | |
| 12142 | 198 | subscreens_passive.clear(); | |
| 12143 | 198 | subscreens_overlay.clear(); | |
| 12144 | 198 | subscreens_map.clear(); | |
| 12145 | |||
| 12146 | byte sz; | ||
| 12147 |
1/2✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
|
198 | if(!p_getc(&sz,f)) |
| 12148 | ✗ | return qe_invalid; | |
| 12149 |
2/2✓ Branch 0 taken 626 times.
✓ Branch 1 taken 198 times.
|
824 | for(byte q = 0; q < sz; ++q) |
| 12150 | { | ||
| 12151 | 626 | ZCSubscreen& tmp = subscreens_active.emplace_back(); | |
| 12152 |
1/2✓ Branch 0 taken 626 times.
✗ Branch 1 not taken.
|
626 | if (auto ret = tmp.read(f, s_version)) |
| 12153 | ✗ | return ret; | |
| 12154 | 626 | } | |
| 12155 |
1/2✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
|
198 | if(!p_getc(&sz,f)) |
| 12156 | ✗ | return qe_invalid; | |
| 12157 |
2/2✓ Branch 0 taken 753 times.
✓ Branch 1 taken 198 times.
|
951 | for(byte q = 0; q < sz; ++q) |
| 12158 | { | ||
| 12159 | 753 | ZCSubscreen& tmp = subscreens_passive.emplace_back(); | |
| 12160 |
1/2✓ Branch 0 taken 753 times.
✗ Branch 1 not taken.
|
753 | if (auto ret = tmp.read(f, s_version)) |
| 12161 | ✗ | return ret; | |
| 12162 | 753 | } | |
| 12163 |
1/2✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
|
198 | if(!p_getc(&sz,f)) |
| 12164 | ✗ | return qe_invalid; | |
| 12165 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 198 times.
|
208 | for(byte q = 0; q < sz; ++q) |
| 12166 | { | ||
| 12167 | 10 | ZCSubscreen& tmp = subscreens_overlay.emplace_back(); | |
| 12168 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if (auto ret = tmp.read(f, s_version)) |
| 12169 | ✗ | return ret; | |
| 12170 | 10 | } | |
| 12171 |
2/2✓ Branch 0 taken 65 times.
✓ Branch 1 taken 133 times.
|
198 | if (s_version >= 16) |
| 12172 | { | ||
| 12173 |
1/2✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
|
133 | if(!p_getc(&sz,f)) |
| 12174 | ✗ | return qe_invalid; | |
| 12175 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 133 times.
|
133 | for(byte q = 0; q < sz; ++q) |
| 12176 | { | ||
| 12177 | ✗ | ZCSubscreen& tmp = subscreens_map.emplace_back(); | |
| 12178 | ✗ | if (auto ret = tmp.read(f, s_version)) | |
| 12179 | ✗ | return ret; | |
| 12180 | ✗ | } | |
| 12181 | 133 | } | |
| 12182 | 198 | return 0; | |
| 12183 | 415 | } | |
| 12184 | |||
| 12185 | ✗ | void reset_subscreen(subscreen_group *tempss) | |
| 12186 | { | ||
| 12187 | ✗ | for(int32_t i=0; i<OLD_MAXSUBSCREENITEMS; ++i) | |
| 12188 | { | ||
| 12189 | ✗ | switch(tempss->objects[i].type) | |
| 12190 | { | ||
| 12191 | case ssoTEXT: | ||
| 12192 | case ssoTEXTBOX: | ||
| 12193 | case ssoCURRENTITEMTEXT: | ||
| 12194 | case ssoCURRENTITEMCLASSTEXT: | ||
| 12195 | ✗ | if(tempss->objects[i].dp1 != NULL) delete [](char *)tempss->objects[i].dp1; | |
| 12196 | |||
| 12197 | //fall through | ||
| 12198 | default: | ||
| 12199 | ✗ | memset(&tempss->objects[i],0,sizeof(subscreen_object)); | |
| 12200 | ✗ | break; | |
| 12201 | } | ||
| 12202 | ✗ | } | |
| 12203 | ✗ | } | |
| 12204 | |||
| 12205 | 116 | void reset_subscreens() | |
| 12206 | { | ||
| 12207 | 116 | subscreens_active.clear(); | |
| 12208 | 116 | subscreens_passive.clear(); | |
| 12209 | 116 | subscreens_overlay.clear(); | |
| 12210 | 116 | subscreens_map.clear(); | |
| 12211 | 116 | } | |
| 12212 | |||
| 12213 | 116 | int32_t setupsubscreens() | |
| 12214 | { | ||
| 12215 | 116 | reset_subscreens(); | |
| 12216 | //return 0; | ||
| 12217 |
2/2✓ Branch 0 taken 116 times.
✓ Branch 1 taken 232 times.
|
348 | for(int q = 0; q < 2; ++q) |
| 12218 | { | ||
| 12219 | 232 | subscreens_active.emplace_back(); | |
| 12220 | 232 | subscreens_passive.emplace_back(); | |
| 12221 | 232 | } | |
| 12222 | 116 | int32_t tempsubscreen=subscr_mode; | |
| 12223 | |||
| 12224 |
1/2✓ Branch 0 taken 116 times.
✗ Branch 1 not taken.
|
116 | if(tempsubscreen>=ssdtMAX) |
| 12225 | ✗ | tempsubscreen=0; | |
| 12226 | |||
| 12227 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 116 times.
✗ Branch 2 not taken.
|
116 | switch(tempsubscreen) |
| 12228 | { | ||
| 12229 | case ssdtOLD: | ||
| 12230 | case ssdtNEWSUBSCR: | ||
| 12231 | case ssdtREV2: | ||
| 12232 | case ssdtBSZELDA: | ||
| 12233 | case ssdtBSZELDAMODIFIED: | ||
| 12234 | case ssdtBSZELDAENHANCED: | ||
| 12235 | case ssdtBSZELDACOMPLETE: | ||
| 12236 | { | ||
| 12237 | 116 | subscreens_active[0].load_old(default_subscreen_active[tempsubscreen][0]); | |
| 12238 | 116 | subscreens_active[0].sub_type=sstACTIVE; | |
| 12239 | 116 | subscreens_active[0].name = "Active Subscreen (Triforce)"; | |
| 12240 | 116 | subscreens_active[1].load_old(default_subscreen_active[tempsubscreen][1]); | |
| 12241 | 116 | subscreens_active[1].sub_type=sstACTIVE; | |
| 12242 | 116 | subscreens_active[1].name = "Active Subscreen (Dungeon Map)"; | |
| 12243 | 116 | subscreens_passive[0].load_old(default_subscreen_passive[tempsubscreen][0]); | |
| 12244 | 116 | subscreens_passive[0].sub_type=sstPASSIVE; | |
| 12245 | 116 | subscreens_passive[0].name = "Passive Subscreen (Magic)"; | |
| 12246 | 116 | subscreens_passive[1].load_old(default_subscreen_passive[tempsubscreen][1]); | |
| 12247 | 116 | subscreens_passive[1].sub_type=sstPASSIVE; | |
| 12248 | 116 | subscreens_passive[1].name = "Passive Subscreen (No Magic)"; | |
| 12249 | 116 | break; | |
| 12250 | } | ||
| 12251 | |||
| 12252 | case ssdtZ3: | ||
| 12253 | { | ||
| 12254 | ✗ | subscreens_active[0].load_old(z3_active_a); | |
| 12255 | ✗ | subscreens_active[0].sub_type=sstACTIVE; | |
| 12256 | ✗ | subscreens_active[1].load_old(z3_active_ab); | |
| 12257 | ✗ | subscreens_active[1].sub_type=sstACTIVE; | |
| 12258 | ✗ | subscreens_passive[0].load_old(z3_passive_a); | |
| 12259 | ✗ | subscreens_passive[0].sub_type=sstPASSIVE; | |
| 12260 | ✗ | subscreens_passive[1].load_old(z3_passive_ab); | |
| 12261 | ✗ | subscreens_passive[1].sub_type=sstPASSIVE; | |
| 12262 | ✗ | break; | |
| 12263 | } | ||
| 12264 | } | ||
| 12265 | 116 | subscr_mode = ssdtMAX; | |
| 12266 | 116 | return 0; | |
| 12267 | } | ||
| 12268 | |||
| 12269 | extern std::vector<std::shared_ptr<zasm_script>> zasm_scripts; | ||
| 12270 | |||
| 12271 | extern script_data *ffscripts[NUMSCRIPTFFC]; | ||
| 12272 | extern script_data *itemscripts[NUMSCRIPTITEM]; | ||
| 12273 | extern script_data *guyscripts[NUMSCRIPTGUYS]; | ||
| 12274 | extern script_data *lwpnscripts[NUMSCRIPTWEAPONS]; | ||
| 12275 | extern script_data *ewpnscripts[NUMSCRIPTWEAPONS]; | ||
| 12276 | extern script_data *globalscripts[NUMSCRIPTGLOBAL]; | ||
| 12277 | extern script_data *genericscripts[NUMSCRIPTSGENERIC]; | ||
| 12278 | extern script_data *playerscripts[NUMSCRIPTHERO]; | ||
| 12279 | extern script_data *screenscripts[NUMSCRIPTSCREEN]; | ||
| 12280 | extern script_data *dmapscripts[NUMSCRIPTSDMAP]; | ||
| 12281 | extern script_data *itemspritescripts[NUMSCRIPTSITEMSPRITE]; | ||
| 12282 | extern script_data *comboscripts[NUMSCRIPTSCOMBODATA]; | ||
| 12283 | extern script_data *subscreenscripts[NUMSCRIPTSSUBSCREEN]; | ||
| 12284 | |||
| 12285 | static std::vector<const script_data*> read_scripts; | ||
| 12286 | |||
| 12287 | 441 | static script_data fake_script_data(ScriptType::None, 0); | |
| 12288 | |||
| 12289 | 527 | int32_t readffscript(PACKFILE *f, zquestheader *Header) | |
| 12290 | { | ||
| 12291 | int32_t dummy; | ||
| 12292 | 527 | word s_version=0, zmeta_version=0; | |
| 12293 | 527 | byte numscripts=0; | |
| 12294 | 527 | numscripts=numscripts; //to avoid unused variables warnings | |
| 12295 | int32_t ret; | ||
| 12296 | 527 | read_scripts.clear(); | |
| 12297 | 527 | zasm_scripts.clear(); | |
| 12298 | |||
| 12299 | //section version info | ||
| 12300 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 527 times.
|
527 | if(!p_igetw(&s_version,f)) |
| 12301 | { | ||
| 12302 | ✗ | return qe_invalid; | |
| 12303 | } | ||
| 12304 | |||
| 12305 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 527 times.
|
527 | if (s_version > V_FFSCRIPT) |
| 12306 | ✗ | return qe_version; | |
| 12307 | |||
| 12308 | 527 | FFCore.quest_format[vFFScript] = s_version; | |
| 12309 | |||
| 12310 |
1/2✓ Branch 0 taken 527 times.
✗ Branch 1 not taken.
|
527 | if(!read_deprecated_section_cversion(f)) |
| 12311 | { | ||
| 12312 | ✗ | return qe_invalid; | |
| 12313 | } | ||
| 12314 | |||
| 12315 |
2/2✓ Branch 0 taken 312 times.
✓ Branch 1 taken 215 times.
|
527 | if(s_version >= 18) |
| 12316 | { | ||
| 12317 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if(!p_igetw(&zmeta_version,f)) |
| 12318 | { | ||
| 12319 | ✗ | return qe_invalid; | |
| 12320 | } | ||
| 12321 | 215 | } | |
| 12322 | |||
| 12323 | //section size | ||
| 12324 |
1/2✓ Branch 0 taken 527 times.
✗ Branch 1 not taken.
|
527 | if(!p_igetl(&dummy,f)) |
| 12325 | { | ||
| 12326 | ✗ | return qe_invalid; | |
| 12327 | } | ||
| 12328 | |||
| 12329 |
2/2✓ Branch 0 taken 307 times.
✓ Branch 1 taken 220 times.
|
527 | if ( FFCore.quest_format[vLastCompile] < 13 ) FFCore.quest_format[vLastCompile] = s_version; |
| 12330 | 527 | al_trace("Loaded scripts last compiled in ZScript version: %d\n", (FFCore.quest_format[vLastCompile])); | |
| 12331 | |||
| 12332 |
2/2✓ Branch 0 taken 303 times.
✓ Branch 1 taken 148 times.
|
527 | if(s_version >= 27) |
| 12333 | { | ||
| 12334 | 148 | ret = read_quest_zasm(f, s_version); | |
| 12335 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 148 times.
|
148 | if(ret) |
| 12336 | ✗ | return qe_invalid; | |
| 12337 | 148 | } | |
| 12338 | |||
| 12339 | //finally... section data | ||
| 12340 |
2/2✓ Branch 0 taken 212480 times.
✓ Branch 1 taken 451 times.
|
212931 | for(int32_t i = 0; i < ((s_version < 2) ? NUMSCRIPTFFCOLD : NUMSCRIPTFFC); i++) |
| 12341 | { | ||
| 12342 | 212480 | ret = read_one_ffscript(f, Header, i, s_version, ffscripts[i], zmeta_version); | |
| 12343 | |||
| 12344 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 212480 times.
|
212480 | if (ret) |
| 12345 | { | ||
| 12346 | ✗ | return qe_invalid; | |
| 12347 | } | ||
| 12348 | 212480 | } | |
| 12349 | |||
| 12350 | /* HIGHLY UNORTHODOX UPDATING THING, by Deedee | ||
| 12351 | * This fixes changes to sprite jump values introduced in early 2.55 alphas. | ||
| 12352 | * Zoria didn't bump up the versions as liberally as he should have, but thankfully | ||
| 12353 | * there was a version bump a week before a change that broke stuff. | ||
| 12354 | */ | ||
| 12355 |
7/8✓ Branch 0 taken 215 times.
✓ Branch 1 taken 236 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 215 times.
✓ Branch 4 taken 215 times.
✓ Branch 5 taken 215 times.
✓ Branch 6 taken 215 times.
✓ Branch 7 taken 215 times.
|
451 | if(((Header->zelda_version < 0x253)||((Header->zelda_version == 0x253)&&(Header->build<33))||((Header->zelda_version > 0x253) && s_version < 12))) |
| 12356 | { | ||
| 12357 | 666 | set_qr(qr_SPRITE_JUMP_IS_TRUNCATED,1); | |
| 12358 | 666 | } | |
| 12359 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 200 times.
|
415 | if(s_version < 19) |
| 12360 | { | ||
| 12361 | 200 | set_qr(qr_FLUCTUATING_ENEMY_JUMP,1); | |
| 12362 | 200 | } | |
| 12363 | |||
| 12364 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if(s_version > 1) |
| 12365 | { | ||
| 12366 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 415 times.
|
106655 | for(int32_t i = 0; i < NUMSCRIPTITEM; i++) |
| 12367 | { | ||
| 12368 | 106240 | ret = read_one_ffscript(f, Header, i, s_version, itemscripts[i], zmeta_version); | |
| 12369 | |||
| 12370 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if (ret) |
| 12371 | { | ||
| 12372 | ✗ | return qe_invalid; | |
| 12373 | } | ||
| 12374 | 106240 | } | |
| 12375 | |||
| 12376 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 415 times.
|
106655 | for(int32_t i = 0; i < NUMSCRIPTGUYS; i++) |
| 12377 | { | ||
| 12378 | 106240 | ret = read_one_ffscript(f, Header, i, s_version, guyscripts[i], zmeta_version); | |
| 12379 | |||
| 12380 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if (ret) |
| 12381 | { | ||
| 12382 | ✗ | return qe_invalid; | |
| 12383 | } | ||
| 12384 | 106240 | } | |
| 12385 | |||
| 12386 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 415 times.
|
106655 | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) |
| 12387 | { | ||
| 12388 | 106240 | ret = read_one_ffscript(f, Header, i, s_version, &fake_script_data, zmeta_version); | |
| 12389 | |||
| 12390 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if (ret) |
| 12391 | { | ||
| 12392 | ✗ | return qe_invalid; | |
| 12393 | } | ||
| 12394 | 106240 | } | |
| 12395 | |||
| 12396 |
2/2✓ Branch 0 taken 106240 times.
✓ Branch 1 taken 415 times.
|
106655 | for(int32_t i = 0; i < NUMSCRIPTSCREEN; i++) |
| 12397 | { | ||
| 12398 | 106240 | ret = read_one_ffscript(f, Header, i, s_version, screenscripts[i], zmeta_version); | |
| 12399 | |||
| 12400 |
1/2✓ Branch 0 taken 106240 times.
✗ Branch 1 not taken.
|
106240 | if (ret) |
| 12401 | { | ||
| 12402 | ✗ | return qe_invalid; | |
| 12403 | } | ||
| 12404 | 106240 | } | |
| 12405 | |||
| 12406 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 200 times.
|
415 | if(s_version > 16) |
| 12407 | { | ||
| 12408 |
2/2✓ Branch 0 taken 1720 times.
✓ Branch 1 taken 215 times.
|
1935 | for(int32_t i = 0; i < NUMSCRIPTGLOBAL; ++i) |
| 12409 | { | ||
| 12410 | 1720 | ret = read_one_ffscript(f, Header, i, s_version, globalscripts[i], zmeta_version); | |
| 12411 | |||
| 12412 |
1/2✓ Branch 0 taken 1720 times.
✗ Branch 1 not taken.
|
1720 | if (ret) |
| 12413 | { | ||
| 12414 | ✗ | return qe_invalid; | |
| 12415 | } | ||
| 12416 | 1720 | } | |
| 12417 | 215 | } | |
| 12418 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | else if(s_version > 13) |
| 12419 | { | ||
| 12420 | ✗ | for(int32_t i = 0; i < NUMSCRIPTGLOBAL255OLD; ++i) | |
| 12421 | { | ||
| 12422 | ✗ | ret = read_one_ffscript(f, Header, i, s_version, globalscripts[i], zmeta_version); | |
| 12423 | |||
| 12424 | ✗ | if (ret) | |
| 12425 | { | ||
| 12426 | ✗ | return qe_invalid; | |
| 12427 | } | ||
| 12428 | ✗ | } | |
| 12429 | |||
| 12430 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVE] != NULL) | |
| 12431 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONSAVE]; | |
| 12432 | |||
| 12433 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVE] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONSAVE); | |
| 12434 | ✗ | } | |
| 12435 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | else if(s_version > 4) |
| 12436 | { | ||
| 12437 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i = 0; i < NUMSCRIPTGLOBAL253; ++i) |
| 12438 | { | ||
| 12439 | 800 | ret = read_one_ffscript(f, Header, i, s_version, globalscripts[i], zmeta_version); | |
| 12440 | |||
| 12441 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if (ret) |
| 12442 | { | ||
| 12443 | ✗ | return qe_invalid; | |
| 12444 | } | ||
| 12445 | 800 | } | |
| 12446 | |||
| 12447 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if(globalscripts[GLOBAL_SCRIPT_ONLAUNCH] != NULL) |
| 12448 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | delete globalscripts[GLOBAL_SCRIPT_ONLAUNCH]; |
| 12449 | |||
| 12450 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | globalscripts[GLOBAL_SCRIPT_ONLAUNCH] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONLAUNCH); |
| 12451 | |||
| 12452 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if(globalscripts[GLOBAL_SCRIPT_ONCONTGAME] != NULL) |
| 12453 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | delete globalscripts[GLOBAL_SCRIPT_ONCONTGAME]; |
| 12454 | |||
| 12455 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | globalscripts[GLOBAL_SCRIPT_ONCONTGAME] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONCONTGAME); |
| 12456 | |||
| 12457 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if(globalscripts[GLOBAL_SCRIPT_F6] != NULL) |
| 12458 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | delete globalscripts[GLOBAL_SCRIPT_F6]; |
| 12459 | |||
| 12460 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | globalscripts[GLOBAL_SCRIPT_F6] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_F6); |
| 12461 | |||
| 12462 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if(globalscripts[GLOBAL_SCRIPT_ONSAVE] != NULL) |
| 12463 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | delete globalscripts[GLOBAL_SCRIPT_ONSAVE]; |
| 12464 | |||
| 12465 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | globalscripts[GLOBAL_SCRIPT_ONSAVE] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONSAVE); |
| 12466 | 200 | } | |
| 12467 | else | ||
| 12468 | { | ||
| 12469 | ✗ | for(int32_t i = 0; i < NUMSCRIPTGLOBALOLD; i++) | |
| 12470 | { | ||
| 12471 | ✗ | ret = read_one_ffscript(f, Header, i, s_version, globalscripts[i], zmeta_version); | |
| 12472 | |||
| 12473 | ✗ | if (ret) | |
| 12474 | { | ||
| 12475 | ✗ | return qe_invalid; | |
| 12476 | } | ||
| 12477 | ✗ | } | |
| 12478 | |||
| 12479 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVELOAD] != NULL) | |
| 12480 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONSAVELOAD]; | |
| 12481 | |||
| 12482 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVELOAD] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONSAVELOAD); | |
| 12483 | |||
| 12484 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONLAUNCH] != NULL) | |
| 12485 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONLAUNCH]; | |
| 12486 | |||
| 12487 | ✗ | globalscripts[GLOBAL_SCRIPT_ONLAUNCH] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONLAUNCH); | |
| 12488 | |||
| 12489 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONCONTGAME] != NULL) | |
| 12490 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONCONTGAME]; | |
| 12491 | |||
| 12492 | ✗ | globalscripts[GLOBAL_SCRIPT_ONCONTGAME] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONCONTGAME); | |
| 12493 | |||
| 12494 | ✗ | if(globalscripts[GLOBAL_SCRIPT_F6] != NULL) | |
| 12495 | ✗ | delete globalscripts[GLOBAL_SCRIPT_F6]; | |
| 12496 | |||
| 12497 | ✗ | globalscripts[GLOBAL_SCRIPT_F6] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_F6); | |
| 12498 | |||
| 12499 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVE] != NULL) | |
| 12500 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONSAVE]; | |
| 12501 | |||
| 12502 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVE] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONSAVE); | |
| 12503 | } | ||
| 12504 | |||
| 12505 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 200 times.
|
415 | if(s_version > 10) //expanded the number of Hero scripts to 5. |
| 12506 | { | ||
| 12507 |
2/2✓ Branch 0 taken 1075 times.
✓ Branch 1 taken 215 times.
|
1290 | for(int32_t i = 0; i < NUMSCRIPTHERO; i++) |
| 12508 | { | ||
| 12509 | 1075 | ret = read_one_ffscript(f, Header, i, s_version, playerscripts[i], zmeta_version); | |
| 12510 | |||
| 12511 |
1/2✓ Branch 0 taken 1075 times.
✗ Branch 1 not taken.
|
1075 | if (ret) |
| 12512 | { | ||
| 12513 | ✗ | return qe_invalid; | |
| 12514 | } | ||
| 12515 | 1075 | } | |
| 12516 | 215 | } | |
| 12517 | else | ||
| 12518 | { | ||
| 12519 |
2/2✓ Branch 0 taken 600 times.
✓ Branch 1 taken 200 times.
|
800 | for(int32_t i = 0; i < NUMSCRIPTHEROOLD; i++) |
| 12520 | { | ||
| 12521 | 600 | ret = read_one_ffscript(f, Header, i, s_version, playerscripts[i], zmeta_version); | |
| 12522 | |||
| 12523 |
1/2✓ Branch 0 taken 600 times.
✗ Branch 1 not taken.
|
600 | if (ret) |
| 12524 | { | ||
| 12525 | ✗ | return qe_invalid; | |
| 12526 | } | ||
| 12527 | 600 | } | |
| 12528 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(playerscripts[3] != NULL) |
| 12529 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | delete playerscripts[3]; |
| 12530 | |||
| 12531 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | playerscripts[3] = new script_data(ScriptType::Hero, 3); |
| 12532 | |||
| 12533 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(playerscripts[4] != NULL) |
| 12534 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | delete playerscripts[4]; |
| 12535 | |||
| 12536 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | playerscripts[4] = new script_data(ScriptType::Hero, 4); |
| 12537 | } | ||
| 12538 |
3/4✓ Branch 0 taken 215 times.
✓ Branch 1 taken 200 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
415 | if(s_version > 8 && s_version < 10) |
| 12539 | { | ||
| 12540 | |||
| 12541 | ✗ | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) | |
| 12542 | { | ||
| 12543 | ✗ | ret = read_one_ffscript(f, Header, i, s_version, ewpnscripts[i], zmeta_version); | |
| 12544 | |||
| 12545 | ✗ | if (ret) | |
| 12546 | { | ||
| 12547 | ✗ | return qe_invalid; | |
| 12548 | } | ||
| 12549 | ✗ | } | |
| 12550 | ✗ | for(int32_t i = 0; i < NUMSCRIPTSDMAP; i++) | |
| 12551 | { | ||
| 12552 | ✗ | ret = read_one_ffscript(f, Header, i, s_version, dmapscripts[i], zmeta_version); | |
| 12553 | |||
| 12554 | ✗ | if (ret) | |
| 12555 | { | ||
| 12556 | ✗ | return qe_invalid; | |
| 12557 | } | ||
| 12558 | ✗ | } | |
| 12559 | |||
| 12560 | ✗ | } | |
| 12561 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 215 times.
|
415 | if(s_version >= 10) |
| 12562 | { | ||
| 12563 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 215 times.
|
55255 | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) |
| 12564 | { | ||
| 12565 | 55040 | ret = read_one_ffscript(f, Header, i, s_version, lwpnscripts[i], zmeta_version); | |
| 12566 | |||
| 12567 |
1/2✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
|
55040 | if (ret) |
| 12568 | { | ||
| 12569 | ✗ | return qe_invalid; | |
| 12570 | } | ||
| 12571 | 55040 | } | |
| 12572 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 215 times.
|
55255 | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) |
| 12573 | { | ||
| 12574 | 55040 | ret = read_one_ffscript(f, Header, i, s_version, ewpnscripts[i], zmeta_version); | |
| 12575 | |||
| 12576 |
1/2✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
|
55040 | if (ret) |
| 12577 | { | ||
| 12578 | ✗ | return qe_invalid; | |
| 12579 | } | ||
| 12580 | 55040 | } | |
| 12581 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 215 times.
|
55255 | for(int32_t i = 0; i < NUMSCRIPTSDMAP; i++) |
| 12582 | { | ||
| 12583 | 55040 | ret = read_one_ffscript(f, Header, i, s_version, dmapscripts[i], zmeta_version); | |
| 12584 | |||
| 12585 |
1/2✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
|
55040 | if (ret) |
| 12586 | { | ||
| 12587 | ✗ | return qe_invalid; | |
| 12588 | } | ||
| 12589 | 55040 | } | |
| 12590 | |||
| 12591 | 215 | } | |
| 12592 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 215 times.
|
415 | if(s_version >=12) |
| 12593 | { | ||
| 12594 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 215 times.
|
55255 | for(int32_t i = 0; i < NUMSCRIPTSITEMSPRITE; i++) |
| 12595 | { | ||
| 12596 | 55040 | ret = read_one_ffscript(f, Header, i, s_version, itemspritescripts[i], zmeta_version); | |
| 12597 | |||
| 12598 |
1/2✓ Branch 0 taken 55040 times.
✗ Branch 1 not taken.
|
55040 | if (ret) |
| 12599 | { | ||
| 12600 | ✗ | return qe_invalid; | |
| 12601 | } | ||
| 12602 | 55040 | } | |
| 12603 | 215 | } | |
| 12604 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 215 times.
|
415 | if(s_version >=15) |
| 12605 | { | ||
| 12606 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 215 times.
|
110295 | for(int32_t i = 0; i < NUMSCRIPTSCOMBODATA; i++) |
| 12607 | { | ||
| 12608 | 110080 | ret = read_one_ffscript(f, Header, i, s_version, comboscripts[i], zmeta_version); | |
| 12609 | |||
| 12610 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if (ret) |
| 12611 | { | ||
| 12612 | ✗ | return qe_invalid; | |
| 12613 | } | ||
| 12614 | 110080 | } | |
| 12615 | 215 | } | |
| 12616 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 215 times.
|
415 | if(s_version >19) |
| 12617 | { | ||
| 12618 | 215 | word numgenscripts = NUMSCRIPTSGENERIC; | |
| 12619 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if(!p_igetw(&numgenscripts,f)) |
| 12620 | { | ||
| 12621 | ✗ | return qe_invalid; | |
| 12622 | } | ||
| 12623 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 215 times.
|
110295 | for(int32_t i = 0; i < numgenscripts; i++) |
| 12624 | { | ||
| 12625 | 110080 | ret = read_one_ffscript(f, Header, i, s_version, genericscripts[i], zmeta_version); | |
| 12626 | |||
| 12627 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if (ret) |
| 12628 | { | ||
| 12629 | ✗ | return qe_invalid; | |
| 12630 | } | ||
| 12631 | 110080 | } | |
| 12632 | 215 | } | |
| 12633 |
2/2✓ Branch 0 taken 217 times.
✓ Branch 1 taken 198 times.
|
415 | if(s_version >21) |
| 12634 | { | ||
| 12635 | 198 | word numsubscripts = NUMSCRIPTSSUBSCREEN; | |
| 12636 |
1/2✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
|
198 | if(!p_igetw(&numsubscripts,f)) |
| 12637 | { | ||
| 12638 | ✗ | return qe_invalid; | |
| 12639 | } | ||
| 12640 |
2/2✓ Branch 0 taken 50688 times.
✓ Branch 1 taken 198 times.
|
50886 | for(int32_t i = 0; i < numsubscripts; i++) |
| 12641 | { | ||
| 12642 | 50688 | ret = read_one_ffscript(f, Header, i, s_version, subscreenscripts[i], zmeta_version); | |
| 12643 | |||
| 12644 |
1/2✓ Branch 0 taken 50688 times.
✗ Branch 1 not taken.
|
50688 | if (ret) |
| 12645 | { | ||
| 12646 | ✗ | return qe_invalid; | |
| 12647 | } | ||
| 12648 | 50688 | } | |
| 12649 | 198 | } | |
| 12650 | 415 | } | |
| 12651 | |||
| 12652 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if(s_version > 2) |
| 12653 | { | ||
| 12654 | int32_t bufsize; | ||
| 12655 | 415 | p_igetl(&bufsize, f); | |
| 12656 |
2/4✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 415 times.
|
415 | if (bufsize < 0 || bufsize > 1024*1024*10) |
| 12657 | { | ||
| 12658 | // God help anyone storing more than 10MB of code in the script buffer. | ||
| 12659 | ✗ | return qe_invalid; | |
| 12660 | } | ||
| 12661 | 415 | char * buf = new char[bufsize+1]; | |
| 12662 | 415 | pfread(buf, bufsize, f); | |
| 12663 | 415 | buf[bufsize]=0; | |
| 12664 | |||
| 12665 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | zScript = string(buf); |
| 12666 | |||
| 12667 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | delete[] buf; |
| 12668 | word numffcbindings; | ||
| 12669 | 415 | p_igetw(&numffcbindings, f); | |
| 12670 | |||
| 12671 |
2/2✓ Branch 0 taken 11855 times.
✓ Branch 1 taken 415 times.
|
12270 | for(int32_t i=0; i<numffcbindings; i++) |
| 12672 | { | ||
| 12673 | word id; | ||
| 12674 | 11855 | p_igetw(&id, f); | |
| 12675 | 11855 | p_igetl(&bufsize, f); | |
| 12676 |
2/4✓ Branch 0 taken 11855 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 11855 times.
|
11855 | if (bufsize < 0 || bufsize > 1024) |
| 12677 | ✗ | return qe_invalid; | |
| 12678 | 11855 | buf = new char[bufsize+1]; | |
| 12679 | 11855 | pfread(buf, bufsize, f); | |
| 12680 | 11855 | buf[bufsize]=0; | |
| 12681 | |||
| 12682 | //fix for buggy older saved quests -DD | ||
| 12683 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11855 times.
|
11855 | if(id < NUMSCRIPTFFC-1) |
| 12684 | 11855 | ffcmap[id].scriptname = buf; | |
| 12685 | |||
| 12686 |
1/2✓ Branch 0 taken 11855 times.
✗ Branch 1 not taken.
|
11855 | delete[] buf; |
| 12687 | 11855 | } | |
| 12688 | |||
| 12689 | word numglobalbindings; | ||
| 12690 | 415 | p_igetw(&numglobalbindings, f); | |
| 12691 | |||
| 12692 |
2/2✓ Branch 0 taken 1672 times.
✓ Branch 1 taken 415 times.
|
2087 | for(int32_t i=0; i<numglobalbindings; i++) |
| 12693 | { | ||
| 12694 | word id; | ||
| 12695 | 1672 | p_igetw(&id, f); | |
| 12696 | 1672 | p_igetl(&bufsize, f); | |
| 12697 |
2/4✓ Branch 0 taken 1672 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1672 times.
✗ Branch 3 not taken.
|
1672 | if (bufsize < 0 || bufsize > 1024) |
| 12698 | ✗ | return qe_invalid; | |
| 12699 | 1672 | buf = new char[bufsize+1]; | |
| 12700 | 1672 | pfread(buf, bufsize, f); | |
| 12701 | 1672 | buf[bufsize]=0; | |
| 12702 | |||
| 12703 | // id in principle should be valid, since slot assignment cannot assign a global script to a bogus slot. | ||
| 12704 | // However, because of a corruption bug, some 2.50.x quests contain bogus entries in the global bindings table. | ||
| 12705 | // Ignore these. -DD | ||
| 12706 |
2/2✓ Branch 0 taken 546 times.
✓ Branch 1 taken 1126 times.
|
1672 | if (id < NUMSCRIPTGLOBAL) |
| 12707 | { | ||
| 12708 | //Disable old '~Continue's, they'd wreak havoc. Bit messy, apologies ~Joe | ||
| 12709 |
1/2✓ Branch 0 taken 1126 times.
✗ Branch 1 not taken.
|
1126 | if(strcmp(buf,"~Continue") == 0) |
| 12710 | { | ||
| 12711 | ✗ | globalmap[id].scriptname = ""; | |
| 12712 | |||
| 12713 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVELOAD] != NULL) | |
| 12714 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVELOAD]->disable(); | |
| 12715 | ✗ | } | |
| 12716 | else | ||
| 12717 | { | ||
| 12718 | 1126 | globalmap[id].scriptname = buf; | |
| 12719 | } | ||
| 12720 | 1126 | } | |
| 12721 | |||
| 12722 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1672 times.
|
1672 | delete[] buf; |
| 12723 | 1672 | } | |
| 12724 | |||
| 12725 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if(s_version > 3) |
| 12726 | { | ||
| 12727 | word numitembindings; | ||
| 12728 | 415 | p_igetw(&numitembindings, f); | |
| 12729 | |||
| 12730 |
2/2✓ Branch 0 taken 1391 times.
✓ Branch 1 taken 415 times.
|
1806 | for(int32_t i=0; i<numitembindings; i++) |
| 12731 | { | ||
| 12732 | word id; | ||
| 12733 | 1391 | p_igetw(&id, f); | |
| 12734 | 1391 | p_igetl(&bufsize, f); | |
| 12735 |
2/4✓ Branch 0 taken 1391 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1391 times.
|
1391 | if (bufsize < 0 || bufsize > 1024) |
| 12736 | ✗ | return qe_invalid; | |
| 12737 | 1391 | buf = new char[bufsize+1]; | |
| 12738 | 1391 | pfread(buf, bufsize, f); | |
| 12739 | 1391 | buf[bufsize]=0; | |
| 12740 | |||
| 12741 | //fix this too | ||
| 12742 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1391 times.
|
1391 | if(id <NUMSCRIPTITEM-1) |
| 12743 | 1391 | itemmap[id].scriptname = buf; | |
| 12744 | |||
| 12745 |
1/2✓ Branch 0 taken 1391 times.
✗ Branch 1 not taken.
|
1391 | delete[] buf; |
| 12746 | 1391 | } | |
| 12747 | 415 | } | |
| 12748 | //(v9+) | ||
| 12749 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 215 times.
|
415 | if(s_version > 8) |
| 12750 | { | ||
| 12751 | //npc scripts | ||
| 12752 | word numnpcbindings; | ||
| 12753 | 215 | p_igetw(&numnpcbindings, f); | |
| 12754 | |||
| 12755 |
2/2✓ Branch 0 taken 192 times.
✓ Branch 1 taken 215 times.
|
407 | for(int32_t i=0; i<numnpcbindings; i++) |
| 12756 | { | ||
| 12757 | word id; | ||
| 12758 | 192 | p_igetw(&id, f); | |
| 12759 | 192 | p_igetl(&bufsize, f); | |
| 12760 |
2/4✓ Branch 0 taken 192 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 192 times.
✗ Branch 3 not taken.
|
192 | if (bufsize < 0 || bufsize > 1024) |
| 12761 | ✗ | return qe_invalid; | |
| 12762 | 192 | buf = new char[bufsize+1]; | |
| 12763 | 192 | pfread(buf, bufsize, f); | |
| 12764 | 192 | buf[bufsize]=0; | |
| 12765 | |||
| 12766 | //fix this too | ||
| 12767 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 192 times.
|
192 | if(id <NUMSCRIPTGUYS-1) |
| 12768 | 192 | npcmap[id].scriptname = buf; | |
| 12769 | |||
| 12770 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 192 times.
|
192 | delete[] buf; |
| 12771 | 192 | } | |
| 12772 | //lweapon | ||
| 12773 | word numlwpnbindings; | ||
| 12774 | 215 | p_igetw(&numlwpnbindings, f); | |
| 12775 | |||
| 12776 |
2/2✓ Branch 0 taken 433 times.
✓ Branch 1 taken 215 times.
|
648 | for(int32_t i=0; i<numlwpnbindings; i++) |
| 12777 | { | ||
| 12778 | word id; | ||
| 12779 | 433 | p_igetw(&id, f); | |
| 12780 | 433 | p_igetl(&bufsize, f); | |
| 12781 |
2/4✓ Branch 0 taken 433 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 433 times.
|
433 | if (bufsize < 0 || bufsize > 1024) |
| 12782 | ✗ | return qe_invalid; | |
| 12783 | 433 | buf = new char[bufsize+1]; | |
| 12784 | 433 | pfread(buf, bufsize, f); | |
| 12785 | 433 | buf[bufsize]=0; | |
| 12786 | |||
| 12787 | //fix this too | ||
| 12788 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 433 times.
|
433 | if(id <NUMSCRIPTWEAPONS-1) |
| 12789 | 433 | lwpnmap[id].scriptname = buf; | |
| 12790 | |||
| 12791 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 433 times.
|
433 | delete[] buf; |
| 12792 | 433 | } | |
| 12793 | //eweapon | ||
| 12794 | word numewpnbindings; | ||
| 12795 | 215 | p_igetw(&numewpnbindings, f); | |
| 12796 | |||
| 12797 |
2/2✓ Branch 0 taken 437 times.
✓ Branch 1 taken 215 times.
|
652 | for(int32_t i=0; i<numewpnbindings; i++) |
| 12798 | { | ||
| 12799 | word id; | ||
| 12800 | 437 | p_igetw(&id, f); | |
| 12801 | 437 | p_igetl(&bufsize, f); | |
| 12802 |
2/4✓ Branch 0 taken 437 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 437 times.
✗ Branch 3 not taken.
|
437 | if (bufsize < 0 || bufsize > 1024) |
| 12803 | ✗ | return qe_invalid; | |
| 12804 | 437 | buf = new char[bufsize+1]; | |
| 12805 | 437 | pfread(buf, bufsize, f); | |
| 12806 | 437 | buf[bufsize]=0; | |
| 12807 | |||
| 12808 | //fix this too | ||
| 12809 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 437 times.
|
437 | if(id <NUMSCRIPTWEAPONS-1) |
| 12810 | 437 | ewpnmap[id].scriptname = buf; | |
| 12811 | |||
| 12812 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 437 times.
|
437 | delete[] buf; |
| 12813 | 437 | } | |
| 12814 | //hero | ||
| 12815 | word numherobindings; | ||
| 12816 | 215 | p_igetw(&numherobindings, f); | |
| 12817 | |||
| 12818 |
2/2✓ Branch 0 taken 43 times.
✓ Branch 1 taken 215 times.
|
258 | for(int32_t i=0; i<numherobindings; i++) |
| 12819 | { | ||
| 12820 | word id; | ||
| 12821 | 43 | p_igetw(&id, f); | |
| 12822 | 43 | p_igetl(&bufsize, f); | |
| 12823 |
2/4✓ Branch 0 taken 43 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 43 times.
|
43 | if (bufsize < 0 || bufsize > 1024) |
| 12824 | ✗ | return qe_invalid; | |
| 12825 | 43 | buf = new char[bufsize+1]; | |
| 12826 | 43 | pfread(buf, bufsize, f); | |
| 12827 | 43 | buf[bufsize]=0; | |
| 12828 | |||
| 12829 | //fix this too | ||
| 12830 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 43 times.
|
43 | if(id <NUMSCRIPTHERO-1) |
| 12831 | 43 | playermap[id].scriptname = buf; | |
| 12832 | |||
| 12833 |
1/2✓ Branch 0 taken 43 times.
✗ Branch 1 not taken.
|
43 | delete[] buf; |
| 12834 | 43 | } | |
| 12835 | //dmaps | ||
| 12836 | word numdmapbindings; | ||
| 12837 | 215 | p_igetw(&numdmapbindings, f); | |
| 12838 | |||
| 12839 |
2/2✓ Branch 0 taken 561 times.
✓ Branch 1 taken 215 times.
|
776 | for(int32_t i=0; i<numdmapbindings; i++) |
| 12840 | { | ||
| 12841 | word id; | ||
| 12842 | 561 | p_igetw(&id, f); | |
| 12843 | 561 | p_igetl(&bufsize, f); | |
| 12844 |
2/4✓ Branch 0 taken 561 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 561 times.
|
561 | if (bufsize < 0 || bufsize > 1024) |
| 12845 | ✗ | return qe_invalid; | |
| 12846 | 561 | buf = new char[bufsize+1]; | |
| 12847 | 561 | pfread(buf, bufsize, f); | |
| 12848 | 561 | buf[bufsize]=0; | |
| 12849 | |||
| 12850 | //fix this too | ||
| 12851 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 561 times.
|
561 | if(id <NUMSCRIPTSDMAP-1) |
| 12852 | 561 | dmapmap[id].scriptname = buf; | |
| 12853 | |||
| 12854 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 561 times.
|
561 | delete[] buf; |
| 12855 | 561 | } | |
| 12856 | //screen | ||
| 12857 | word numscreenbindings; | ||
| 12858 | 215 | p_igetw(&numscreenbindings, f); | |
| 12859 | |||
| 12860 |
2/2✓ Branch 0 taken 445 times.
✓ Branch 1 taken 215 times.
|
660 | for(int32_t i=0; i<numscreenbindings; i++) |
| 12861 | { | ||
| 12862 | word id; | ||
| 12863 | 445 | p_igetw(&id, f); | |
| 12864 | 445 | p_igetl(&bufsize, f); | |
| 12865 |
2/4✓ Branch 0 taken 445 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 445 times.
✗ Branch 3 not taken.
|
445 | if (bufsize < 0 || bufsize > 1024) |
| 12866 | ✗ | return qe_invalid; | |
| 12867 | 445 | buf = new char[bufsize+1]; | |
| 12868 | 445 | pfread(buf, bufsize, f); | |
| 12869 | 445 | buf[bufsize]=0; | |
| 12870 | |||
| 12871 | //fix this too | ||
| 12872 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 445 times.
|
445 | if(id <NUMSCRIPTSDMAP-1) |
| 12873 | 445 | screenmap[id].scriptname = buf; | |
| 12874 | |||
| 12875 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 445 times.
|
445 | delete[] buf; |
| 12876 | 445 | } | |
| 12877 | 215 | } | |
| 12878 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 215 times.
|
415 | if(s_version > 11) |
| 12879 | { | ||
| 12880 | word numspritebindings; | ||
| 12881 | 215 | p_igetw(&numspritebindings, f); | |
| 12882 | |||
| 12883 |
2/2✓ Branch 0 taken 71 times.
✓ Branch 1 taken 215 times.
|
286 | for(int32_t i=0; i<numspritebindings; i++) |
| 12884 | { | ||
| 12885 | word id; | ||
| 12886 | 71 | p_igetw(&id, f); | |
| 12887 | 71 | p_igetl(&bufsize, f); | |
| 12888 |
2/4✓ Branch 0 taken 71 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 71 times.
|
71 | if (bufsize < 0 || bufsize > 1024) |
| 12889 | ✗ | return qe_invalid; | |
| 12890 | 71 | buf = new char[bufsize+1]; | |
| 12891 | 71 | pfread(buf, bufsize, f); | |
| 12892 | 71 | buf[bufsize]=0; | |
| 12893 | |||
| 12894 | //fix this too | ||
| 12895 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 71 times.
|
71 | if(id <NUMSCRIPTSDMAP-1) |
| 12896 | 71 | itemspritemap[id].scriptname = buf; | |
| 12897 | |||
| 12898 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 71 times.
|
71 | delete[] buf; |
| 12899 | 71 | } | |
| 12900 | 215 | } | |
| 12901 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 215 times.
|
415 | if(s_version >= 15) |
| 12902 | { | ||
| 12903 | word numcombobindings; | ||
| 12904 | 215 | p_igetw(&numcombobindings, f); | |
| 12905 | |||
| 12906 |
2/2✓ Branch 0 taken 217 times.
✓ Branch 1 taken 215 times.
|
432 | for(int32_t i=0; i<numcombobindings; i++) |
| 12907 | { | ||
| 12908 | word id; | ||
| 12909 | 217 | p_igetw(&id, f); | |
| 12910 | 217 | p_igetl(&bufsize, f); | |
| 12911 |
2/4✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 217 times.
✗ Branch 3 not taken.
|
217 | if (bufsize < 0 || bufsize > 1024) |
| 12912 | ✗ | return qe_invalid; | |
| 12913 | 217 | buf = new char[bufsize+1]; | |
| 12914 | 217 | pfread(buf, bufsize, f); | |
| 12915 | 217 | buf[bufsize]=0; | |
| 12916 | |||
| 12917 | //fix this too | ||
| 12918 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 217 times.
|
217 | if(id <NUMSCRIPTSCOMBODATA-1) |
| 12919 | 217 | comboscriptmap[id].scriptname = buf; | |
| 12920 | |||
| 12921 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 217 times.
|
217 | delete[] buf; |
| 12922 | 217 | } | |
| 12923 | 215 | } | |
| 12924 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 215 times.
|
415 | if(s_version > 19) |
| 12925 | { | ||
| 12926 | word numgenericbindings; | ||
| 12927 | 215 | p_igetw(&numgenericbindings, f); | |
| 12928 | |||
| 12929 |
2/2✓ Branch 0 taken 2624 times.
✓ Branch 1 taken 215 times.
|
2839 | for(int32_t i=0; i<numgenericbindings; i++) |
| 12930 | { | ||
| 12931 | word id; | ||
| 12932 | 2624 | p_igetw(&id, f); | |
| 12933 | 2624 | p_igetl(&bufsize, f); | |
| 12934 |
2/4✓ Branch 0 taken 2624 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2624 times.
✗ Branch 3 not taken.
|
2624 | if (bufsize < 0 || bufsize > 1024) |
| 12935 | ✗ | return qe_invalid; | |
| 12936 | 2624 | buf = new char[bufsize+1]; | |
| 12937 | 2624 | pfread(buf, bufsize, f); | |
| 12938 | 2624 | buf[bufsize]=0; | |
| 12939 | |||
| 12940 | //fix this too | ||
| 12941 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2624 times.
|
2624 | if(id <NUMSCRIPTSGENERIC-1) |
| 12942 | 2624 | genericmap[id].scriptname = buf; | |
| 12943 | |||
| 12944 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2624 times.
|
2624 | delete[] buf; |
| 12945 | 2624 | } | |
| 12946 | 215 | } | |
| 12947 |
2/2✓ Branch 0 taken 217 times.
✓ Branch 1 taken 198 times.
|
415 | if(s_version > 21) |
| 12948 | { | ||
| 12949 | word numsubscreenbindings; | ||
| 12950 | 198 | p_igetw(&numsubscreenbindings, f); | |
| 12951 | |||
| 12952 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 198 times.
|
216 | for(int32_t i=0; i<numsubscreenbindings; i++) |
| 12953 | { | ||
| 12954 | word id; | ||
| 12955 | 18 | p_igetw(&id, f); | |
| 12956 | 18 | p_igetl(&bufsize, f); | |
| 12957 |
2/4✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
|
18 | if (bufsize < 0 || bufsize > 1024) |
| 12958 | ✗ | return qe_invalid; | |
| 12959 | 18 | buf = new char[bufsize+1]; | |
| 12960 | 18 | pfread(buf, bufsize, f); | |
| 12961 | 18 | buf[bufsize]=0; | |
| 12962 | |||
| 12963 | //fix this too | ||
| 12964 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | if(id <NUMSCRIPTSSUBSCREEN-1) |
| 12965 | 18 | subscreenmap[id].scriptname = buf; | |
| 12966 | |||
| 12967 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | delete[] buf; |
| 12968 | 18 | } | |
| 12969 | 198 | } | |
| 12970 | 415 | } | |
| 12971 | |||
| 12972 | // Set ZScriptVersion to the value encoded in the script's meta.ffscript_v. | ||
| 12973 | // This is only updated when the scripts have been recompiled. | ||
| 12974 | // They should all match each other, but there may have been bugs causing this field | ||
| 12975 | // to not always be set so take the largest one. | ||
| 12976 | 415 | std::optional<word> zscript_version; | |
| 12977 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 215 times.
|
415 | if (s_version >= 16) |
| 12978 | { | ||
| 12979 |
2/2✓ Branch 0 taken 9975 times.
✓ Branch 1 taken 215 times.
|
10190 | for (auto script : read_scripts) |
| 12980 | { | ||
| 12981 | // Scripts with "0" were saved in a version prior to this field being set. | ||
| 12982 | // See https://discord.com/channels/876899628556091432/1368485306394738718 | ||
| 12983 |
2/2✓ Branch 0 taken 9882 times.
✓ Branch 1 taken 93 times.
|
9975 | word ffscript_v = script->meta.ffscript_v == 0 ? 16 : script->meta.ffscript_v; |
| 12984 |
2/2✓ Branch 0 taken 9779 times.
✓ Branch 1 taken 196 times.
|
9975 | if (!zscript_version.has_value()) |
| 12985 | 196 | zscript_version = ffscript_v; | |
| 12986 |
1/2✓ Branch 0 taken 9779 times.
✗ Branch 1 not taken.
|
9779 | else if (ffscript_v > zscript_version.value()) |
| 12987 | ✗ | zscript_version = ffscript_v; | |
| 12988 | } | ||
| 12989 | |||
| 12990 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 19 times.
|
215 | if (!zscript_version.has_value()) |
| 12991 | 19 | al_trace("WARNING: Setting zscript version to section version as fallback.\n"); | |
| 12992 | 215 | } | |
| 12993 | 415 | setZScriptVersion(zscript_version.value_or(s_version)); | |
| 12994 | 415 | read_scripts.clear(); | |
| 12995 | |||
| 12996 | 415 | return 0; | |
| 12997 | 415 | } | |
| 12998 | |||
| 12999 | void(*reset_scripts_hook)(); | ||
| 13000 | |||
| 13001 | 496 | void reset_scripts() | |
| 13002 | { | ||
| 13003 | // We can't modify the script data while jit threads are possibly compiling them. | ||
| 13004 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 485 times.
|
496 | if (reset_scripts_hook) |
| 13005 | 485 | reset_scripts_hook(); | |
| 13006 | |||
| 13007 |
2/2✓ Branch 0 taken 253952 times.
✓ Branch 1 taken 496 times.
|
254448 | for(int32_t i=0; i<NUMSCRIPTSGENERIC; i++) |
| 13008 | { | ||
| 13009 |
1/2✓ Branch 0 taken 253952 times.
✗ Branch 1 not taken.
|
253952 | if (genericscripts[i]!=NULL) genericscripts[i]->disable(); |
| 13010 | ✗ | else genericscripts[i] = new script_data({ScriptType::Generic, i}); | |
| 13011 | 253952 | } | |
| 13012 | |||
| 13013 |
2/2✓ Branch 0 taken 253952 times.
✓ Branch 1 taken 496 times.
|
254448 | for(int32_t i=0; i<NUMSCRIPTFFC; i++) |
| 13014 | { | ||
| 13015 |
1/2✓ Branch 0 taken 253952 times.
✗ Branch 1 not taken.
|
253952 | if (ffscripts[i]) |
| 13016 | 253952 | ffscripts[i]->disable(); | |
| 13017 | else | ||
| 13018 | ✗ | ffscripts[i] = new script_data(ScriptType::FFC, i); | |
| 13019 | 253952 | } | |
| 13020 | |||
| 13021 |
2/2✓ Branch 0 taken 126976 times.
✓ Branch 1 taken 496 times.
|
127472 | for(int32_t i=0; i<NUMSCRIPTITEM; i++) |
| 13022 | { | ||
| 13023 |
1/2✓ Branch 0 taken 126976 times.
✗ Branch 1 not taken.
|
126976 | if (itemscripts[i]) |
| 13024 | 126976 | itemscripts[i]->disable(); | |
| 13025 | else | ||
| 13026 | ✗ | itemscripts[i] = new script_data(ScriptType::Item, i); | |
| 13027 | 126976 | } | |
| 13028 | |||
| 13029 |
2/2✓ Branch 0 taken 126976 times.
✓ Branch 1 taken 496 times.
|
127472 | for(int32_t i=0; i<NUMSCRIPTGUYS; i++) |
| 13030 | { | ||
| 13031 |
1/2✓ Branch 0 taken 126976 times.
✗ Branch 1 not taken.
|
126976 | if (guyscripts[i]) |
| 13032 | 126976 | guyscripts[i]->disable(); | |
| 13033 | else | ||
| 13034 | ✗ | guyscripts[i] = new script_data(ScriptType::NPC, i); | |
| 13035 | 126976 | } | |
| 13036 | |||
| 13037 |
2/2✓ Branch 0 taken 126976 times.
✓ Branch 1 taken 496 times.
|
127472 | for(int32_t i=0; i<NUMSCRIPTSCREEN; i++) |
| 13038 | { | ||
| 13039 |
1/2✓ Branch 0 taken 126976 times.
✗ Branch 1 not taken.
|
126976 | if (screenscripts[i]) |
| 13040 | 126976 | screenscripts[i]->disable(); | |
| 13041 | else | ||
| 13042 | ✗ | screenscripts[i] = new script_data(ScriptType::Screen, i); | |
| 13043 | 126976 | } | |
| 13044 | |||
| 13045 |
2/2✓ Branch 0 taken 3968 times.
✓ Branch 1 taken 496 times.
|
4464 | for(int32_t i=0; i<NUMSCRIPTGLOBAL; i++) |
| 13046 | { | ||
| 13047 |
1/2✓ Branch 0 taken 3968 times.
✗ Branch 1 not taken.
|
3968 | if (globalscripts[i]) |
| 13048 | 3968 | globalscripts[i]->disable(); | |
| 13049 | else | ||
| 13050 | ✗ | globalscripts[i] = new script_data(ScriptType::Global, i); | |
| 13051 | 3968 | } | |
| 13052 | |||
| 13053 |
2/2✓ Branch 0 taken 2480 times.
✓ Branch 1 taken 496 times.
|
2976 | for(int32_t i=0; i<NUMSCRIPTHERO; i++) |
| 13054 | { | ||
| 13055 |
1/2✓ Branch 0 taken 2480 times.
✗ Branch 1 not taken.
|
2480 | if (playerscripts[i]) |
| 13056 | 2480 | playerscripts[i]->disable(); | |
| 13057 | else | ||
| 13058 | ✗ | playerscripts[i] = new script_data(ScriptType::Hero, i); | |
| 13059 | 2480 | } | |
| 13060 | |||
| 13061 |
2/2✓ Branch 0 taken 126976 times.
✓ Branch 1 taken 496 times.
|
127472 | for(int32_t i=0; i<NUMSCRIPTWEAPONS; i++) |
| 13062 | { | ||
| 13063 |
1/2✓ Branch 0 taken 126976 times.
✗ Branch 1 not taken.
|
126976 | if (lwpnscripts[i]) |
| 13064 | 126976 | lwpnscripts[i]->disable(); | |
| 13065 | else | ||
| 13066 | ✗ | lwpnscripts[i] = new script_data(ScriptType::Lwpn, i); | |
| 13067 | 126976 | } | |
| 13068 |
2/2✓ Branch 0 taken 126976 times.
✓ Branch 1 taken 496 times.
|
127472 | for(int32_t i=0; i<NUMSCRIPTWEAPONS; i++) |
| 13069 | { | ||
| 13070 |
1/2✓ Branch 0 taken 126976 times.
✗ Branch 1 not taken.
|
126976 | if (ewpnscripts[i]) |
| 13071 | 126976 | ewpnscripts[i]->disable(); | |
| 13072 | else | ||
| 13073 | ✗ | ewpnscripts[i] = new script_data(ScriptType::Ewpn, i); | |
| 13074 | 126976 | } | |
| 13075 | |||
| 13076 |
2/2✓ Branch 0 taken 126976 times.
✓ Branch 1 taken 496 times.
|
127472 | for(int32_t i=0; i<NUMSCRIPTSDMAP; i++) |
| 13077 | { | ||
| 13078 |
1/2✓ Branch 0 taken 126976 times.
✗ Branch 1 not taken.
|
126976 | if (dmapscripts[i]) |
| 13079 | 126976 | dmapscripts[i]->disable(); | |
| 13080 | else | ||
| 13081 | ✗ | dmapscripts[i] = new script_data(ScriptType::DMap, i); | |
| 13082 | 126976 | } | |
| 13083 |
2/2✓ Branch 0 taken 126976 times.
✓ Branch 1 taken 496 times.
|
127472 | for(int32_t i=0; i<NUMSCRIPTSITEMSPRITE; i++) |
| 13084 | { | ||
| 13085 |
1/2✓ Branch 0 taken 126976 times.
✗ Branch 1 not taken.
|
126976 | if (itemspritescripts[i]) |
| 13086 | 126976 | itemspritescripts[i]->disable(); | |
| 13087 | else | ||
| 13088 | ✗ | itemspritescripts[i] = new script_data(ScriptType::ItemSprite, i); | |
| 13089 | 126976 | } | |
| 13090 |
2/2✓ Branch 0 taken 253952 times.
✓ Branch 1 taken 496 times.
|
254448 | for(int32_t i=0; i<NUMSCRIPTSCOMBODATA; i++) |
| 13091 | { | ||
| 13092 |
1/2✓ Branch 0 taken 253952 times.
✗ Branch 1 not taken.
|
253952 | if (comboscripts[i]) |
| 13093 | 253952 | comboscripts[i]->disable(); | |
| 13094 | else | ||
| 13095 | ✗ | comboscripts[i] = new script_data(ScriptType::Combo, i); | |
| 13096 | 253952 | } | |
| 13097 |
2/2✓ Branch 0 taken 496 times.
✓ Branch 1 taken 126976 times.
|
127472 | for(int32_t i=0; i<NUMSCRIPTSSUBSCREEN; i++) |
| 13098 | { | ||
| 13099 |
1/2✓ Branch 0 taken 126976 times.
✗ Branch 1 not taken.
|
126976 | if (subscreenscripts[i]) |
| 13100 | 126976 | subscreenscripts[i]->disable(); | |
| 13101 | else | ||
| 13102 | ✗ | subscreenscripts[i] = new script_data(ScriptType::EngineSubscreen, i); | |
| 13103 | 126976 | } | |
| 13104 | 496 | } | |
| 13105 | |||
| 13106 | // 3.0+ calls this. | ||
| 13107 | 148 | int32_t read_quest_zasm(PACKFILE *f, word s_version) | |
| 13108 | { | ||
| 13109 | int32_t num_commands; | ||
| 13110 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 148 times.
|
148 | if(!p_igetl(&num_commands,f)) |
| 13111 | ✗ | return qe_invalid; | |
| 13112 | #ifdef ZC_FUZZ | ||
| 13113 | const int32_t command_limit = 300000; | ||
| 13114 | #else | ||
| 13115 | 148 | const int32_t command_limit = 25000000; | |
| 13116 | #endif | ||
| 13117 |
2/4✓ Branch 0 taken 148 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 148 times.
|
148 | if (num_commands < 0 || num_commands > command_limit) |
| 13118 | ✗ | return qe_invalid; | |
| 13119 | |||
| 13120 | 148 | std::vector<ffscript> zasm; | |
| 13121 |
1/2✓ Branch 0 taken 148 times.
✗ Branch 1 not taken.
|
148 | zasm.reserve(num_commands); |
| 13122 |
2/2✓ Branch 0 taken 6109761 times.
✓ Branch 1 taken 148 times.
|
6109909 | for(int32_t j=0; j<num_commands; j++) |
| 13123 | { | ||
| 13124 |
1/2✓ Branch 0 taken 6109761 times.
✗ Branch 1 not taken.
|
6109761 | ffscript temp_script; |
| 13125 |
2/4✓ Branch 0 taken 6109761 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6109761 times.
✗ Branch 3 not taken.
|
6109761 | if(!p_igetw(&(temp_script.command),f)) |
| 13126 | ✗ | return qe_invalid; | |
| 13127 | |||
| 13128 |
2/4✓ Branch 0 taken 6109761 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6109761 times.
✗ Branch 3 not taken.
|
6109761 | if(!p_igetl(&(temp_script.arg1),f)) |
| 13129 | ✗ | return qe_invalid; | |
| 13130 | |||
| 13131 |
2/4✓ Branch 0 taken 6109761 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6109761 times.
✗ Branch 3 not taken.
|
6109761 | if(!p_igetl(&(temp_script.arg2),f)) |
| 13132 | ✗ | return qe_invalid; | |
| 13133 | |||
| 13134 |
2/4✓ Branch 0 taken 6109761 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6109761 times.
✗ Branch 3 not taken.
|
6109761 | if(!p_igetl(&(temp_script.arg3),f)) |
| 13135 | ✗ | return qe_invalid; | |
| 13136 | |||
| 13137 | 6109761 | uint32_t sz = 0; | |
| 13138 |
2/4✓ Branch 0 taken 6109761 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6109761 times.
✗ Branch 3 not taken.
|
6109761 | if(!p_igetl(&sz,f)) |
| 13139 | ✗ | return qe_invalid; | |
| 13140 |
2/2✓ Branch 0 taken 50249 times.
✓ Branch 1 taken 6059512 times.
|
6109761 | if(sz) //string found |
| 13141 | { | ||
| 13142 |
1/2✓ Branch 0 taken 50249 times.
✗ Branch 1 not taken.
|
50249 | temp_script.strptr = new std::string(); |
| 13143 | char dummy; | ||
| 13144 |
2/2✓ Branch 0 taken 981353 times.
✓ Branch 1 taken 50249 times.
|
1031602 | for(size_t q = 0; q < sz; ++q) |
| 13145 | { | ||
| 13146 |
2/4✓ Branch 0 taken 981353 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 981353 times.
✗ Branch 3 not taken.
|
981353 | if(!p_getc(&dummy,f)) |
| 13147 | ✗ | return qe_invalid; | |
| 13148 |
1/2✓ Branch 0 taken 981353 times.
✗ Branch 1 not taken.
|
981353 | temp_script.strptr->push_back(dummy); |
| 13149 | 981353 | } | |
| 13150 | 50249 | } | |
| 13151 |
2/4✓ Branch 0 taken 6109761 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6109761 times.
✗ Branch 3 not taken.
|
6109761 | if(!p_igetl(&sz,f)) |
| 13152 | ✗ | return qe_invalid; | |
| 13153 |
2/2✓ Branch 0 taken 8795 times.
✓ Branch 1 taken 6100966 times.
|
6109761 | if(sz) //vector found |
| 13154 | { | ||
| 13155 |
1/2✓ Branch 0 taken 8795 times.
✗ Branch 1 not taken.
|
8795 | temp_script.vecptr = new std::vector<int32_t>(); |
| 13156 | int32_t dummy; | ||
| 13157 |
2/2✓ Branch 0 taken 55395 times.
✓ Branch 1 taken 8795 times.
|
64190 | for(size_t q = 0; q < sz; ++q) |
| 13158 | { | ||
| 13159 |
2/4✓ Branch 0 taken 55395 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 55395 times.
✗ Branch 3 not taken.
|
55395 | if(!p_igetl(&dummy,f)) |
| 13160 | ✗ | return qe_invalid; | |
| 13161 |
1/2✓ Branch 0 taken 55395 times.
✗ Branch 1 not taken.
|
55395 | temp_script.vecptr->push_back(dummy); |
| 13162 | 55395 | } | |
| 13163 | 8795 | } | |
| 13164 |
1/2✓ Branch 0 taken 6109761 times.
✗ Branch 1 not taken.
|
6109761 | zasm.emplace_back(std::move(temp_script)); |
| 13165 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6109761 times.
|
6109761 | } |
| 13166 | |||
| 13167 |
1/2✓ Branch 0 taken 148 times.
✗ Branch 1 not taken.
|
148 | assert(zasm_scripts.empty()); |
| 13168 | 148 | zasm_script_id id = zasm_scripts.size(); | |
| 13169 |
2/4✓ Branch 0 taken 148 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 148 times.
|
148 | zasm_scripts.emplace_back(std::make_shared<zasm_script>(id, "@single", std::move(zasm))); |
| 13170 | |||
| 13171 | 148 | return 0; | |
| 13172 | 148 | } | |
| 13173 | |||
| 13174 | 260735 | int32_t read_one_zmeta(PACKFILE *f, zasm_meta& temp_meta, word zmeta_version) | |
| 13175 | { | ||
| 13176 | 260735 | char b33[34] = { 0 }; | |
| 13177 | 260735 | b33[33] = 0; | |
| 13178 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 260735 times.
|
260735 | if(!p_igetw(&(temp_meta.zasm_v),f)) |
| 13179 | ✗ | return qe_invalid; | |
| 13180 |
1/2✓ Branch 0 taken 260735 times.
✗ Branch 1 not taken.
|
260735 | if(!p_igetw(&(temp_meta.meta_v),f)) |
| 13181 | ✗ | return qe_invalid; | |
| 13182 |
1/2✓ Branch 0 taken 260735 times.
✗ Branch 1 not taken.
|
260735 | if(!p_igetw(&(temp_meta.ffscript_v),f)) |
| 13183 | ✗ | return qe_invalid; | |
| 13184 |
1/2✓ Branch 0 taken 260735 times.
✗ Branch 1 not taken.
|
260735 | if(!p_getc(&(temp_meta.script_type),f)) |
| 13185 | ✗ | return qe_invalid; | |
| 13186 | |||
| 13187 |
2/2✓ Branch 0 taken 2085112 times.
✓ Branch 1 taken 260735 times.
|
2345847 | for(int32_t q = 0; q < 8; ++q) |
| 13188 | { | ||
| 13189 |
2/2✓ Branch 0 taken 143880 times.
✓ Branch 1 taken 1941232 times.
|
2085112 | if(zmeta_version < 3) |
| 13190 | { | ||
| 13191 |
2/2✓ Branch 0 taken 4748040 times.
✓ Branch 1 taken 143880 times.
|
4891920 | for(int32_t c = 0; c < 33; ++c) |
| 13192 | { | ||
| 13193 |
1/2✓ Branch 0 taken 4748040 times.
✗ Branch 1 not taken.
|
4748040 | if(!p_getc(&(b33[c]),f)) |
| 13194 | { | ||
| 13195 | ✗ | return qe_invalid; | |
| 13196 | } | ||
| 13197 | 4748040 | } | |
| 13198 | 143880 | temp_meta.run_idens[q].assign(b33); | |
| 13199 | 143880 | } | |
| 13200 | else | ||
| 13201 | { | ||
| 13202 |
1/2✓ Branch 0 taken 1941232 times.
✗ Branch 1 not taken.
|
1941232 | if(!p_getcstr(&temp_meta.run_idens[q],f)) |
| 13203 | { | ||
| 13204 | ✗ | return qe_invalid; | |
| 13205 | } | ||
| 13206 | } | ||
| 13207 | 2085112 | } | |
| 13208 | |||
| 13209 |
2/2✓ Branch 0 taken 2085112 times.
✓ Branch 1 taken 260735 times.
|
2345847 | for(int32_t q = 0; q < 8; ++q) |
| 13210 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2085112 times.
|
2085112 | if(!p_getc(&(temp_meta.run_types[q]),f)) |
| 13211 | ✗ | return qe_invalid; | |
| 13212 | |||
| 13213 |
1/2✓ Branch 0 taken 260735 times.
✗ Branch 1 not taken.
|
260735 | if(!p_getc(&(temp_meta.flags),f)) |
| 13214 | ✗ | return qe_invalid; | |
| 13215 | |||
| 13216 |
1/2✓ Branch 0 taken 260735 times.
✗ Branch 1 not taken.
|
260735 | if(!p_igetw(&(temp_meta.compiler_v1),f)) |
| 13217 | ✗ | return qe_invalid; | |
| 13218 |
1/2✓ Branch 0 taken 260735 times.
✗ Branch 1 not taken.
|
260735 | if(!p_igetw(&(temp_meta.compiler_v2),f)) |
| 13219 | ✗ | return qe_invalid; | |
| 13220 |
1/2✓ Branch 0 taken 260735 times.
✗ Branch 1 not taken.
|
260735 | if(!p_igetw(&(temp_meta.compiler_v3),f)) |
| 13221 | ✗ | return qe_invalid; | |
| 13222 |
1/2✓ Branch 0 taken 260735 times.
✗ Branch 1 not taken.
|
260735 | if(!p_igetw(&(temp_meta.compiler_v4),f)) |
| 13223 | ✗ | return qe_invalid; | |
| 13224 | |||
| 13225 |
2/2✓ Branch 0 taken 17985 times.
✓ Branch 1 taken 242750 times.
|
260735 | if(zmeta_version == 2) |
| 13226 | { | ||
| 13227 |
2/2✓ Branch 0 taken 593505 times.
✓ Branch 1 taken 17985 times.
|
611490 | for(int32_t c = 0; c < 33; ++c) |
| 13228 | { | ||
| 13229 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 593505 times.
|
593505 | if(!p_getc(&b33[c],f)) |
| 13230 | { | ||
| 13231 | ✗ | return qe_invalid; | |
| 13232 | } | ||
| 13233 | 593505 | } | |
| 13234 | 17985 | temp_meta.script_name.assign(b33); | |
| 13235 | |||
| 13236 |
2/2✓ Branch 0 taken 593505 times.
✓ Branch 1 taken 17985 times.
|
611490 | for(int32_t c = 0; c < 33; ++c) |
| 13237 | { | ||
| 13238 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 593505 times.
|
593505 | if(!p_getc(&b33[c],f)) |
| 13239 | { | ||
| 13240 | ✗ | return qe_invalid; | |
| 13241 | } | ||
| 13242 | 593505 | } | |
| 13243 | 17985 | temp_meta.author.assign(b33); | |
| 13244 | 17985 | } | |
| 13245 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 242750 times.
|
242750 | else if(zmeta_version > 2) |
| 13246 | { | ||
| 13247 |
1/2✓ Branch 0 taken 242750 times.
✗ Branch 1 not taken.
|
242750 | if(!p_getcstr(&temp_meta.script_name,f)) |
| 13248 | ✗ | return qe_invalid; | |
| 13249 |
1/2✓ Branch 0 taken 242750 times.
✗ Branch 1 not taken.
|
242750 | if(!p_getcstr(&temp_meta.author,f)) |
| 13250 | ✗ | return qe_invalid; | |
| 13251 | 242750 | word num_meta_attrib = (zmeta_version < 5 ? 4 : 10); | |
| 13252 | 242750 | string tmpstr; | |
| 13253 |
2/2✓ Branch 0 taken 228585 times.
✓ Branch 1 taken 14165 times.
|
242750 | if (zmeta_version < 6) |
| 13254 | { | ||
| 13255 |
2/2✓ Branch 0 taken 228585 times.
✓ Branch 1 taken 2285850 times.
|
2514435 | for(auto q = 0; q < num_meta_attrib; ++q) |
| 13256 | { | ||
| 13257 |
2/4✓ Branch 0 taken 2285850 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2285850 times.
✗ Branch 3 not taken.
|
2285850 | if(!p_getcstr(&temp_meta.attributes[q],f)) |
| 13258 | ✗ | return qe_invalid; | |
| 13259 |
2/4✓ Branch 0 taken 2285850 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2285850 times.
✗ Branch 3 not taken.
|
2285850 | if(!p_getwstr(&temp_meta.attributes_help[q],f)) |
| 13260 | ✗ | return qe_invalid; | |
| 13261 | 2285850 | } | |
| 13262 |
2/2✓ Branch 0 taken 1828680 times.
✓ Branch 1 taken 228585 times.
|
2057265 | for(auto q = 0; q < 8; ++q) |
| 13263 | { | ||
| 13264 |
2/4✓ Branch 0 taken 1828680 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1828680 times.
✗ Branch 3 not taken.
|
1828680 | if(!p_getcstr(&tmpstr,f)) |
| 13265 | ✗ | return qe_invalid; | |
| 13266 |
2/2✓ Branch 0 taken 457170 times.
✓ Branch 1 taken 1371510 times.
|
1828680 | if (8+q >= num_meta_attrib || !tmpstr.empty()) |
| 13267 |
2/2✓ Branch 0 taken 1371558 times.
✓ Branch 1 taken 48 times.
|
1371510 | temp_meta.attributes[8+q] = tmpstr; |
| 13268 |
3/4✓ Branch 0 taken 1828680 times.
✓ Branch 1 taken 48 times.
✓ Branch 2 taken 1828680 times.
✗ Branch 3 not taken.
|
1828728 | if(!p_getwstr(&tmpstr,f)) |
| 13269 | ✗ | return qe_invalid; | |
| 13270 |
4/4✓ Branch 0 taken 457170 times.
✓ Branch 1 taken 1371510 times.
✓ Branch 2 taken 457136 times.
✓ Branch 3 taken 34 times.
|
1828680 | if (8+q >= num_meta_attrib || !tmpstr.empty()) |
| 13271 |
1/2✓ Branch 0 taken 1371544 times.
✗ Branch 1 not taken.
|
1371544 | temp_meta.attributes_help[8+q] = tmpstr; |
| 13272 | 1828680 | } | |
| 13273 |
2/2✓ Branch 0 taken 1828680 times.
✓ Branch 1 taken 228585 times.
|
2057265 | for(auto q = 0; q < 8; ++q) |
| 13274 | { | ||
| 13275 |
2/4✓ Branch 0 taken 1828680 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1828680 times.
✗ Branch 3 not taken.
|
1828680 | if(!p_getcstr(&temp_meta.attributes[16+q],f)) |
| 13276 | ✗ | return qe_invalid; | |
| 13277 |
2/4✓ Branch 0 taken 1828680 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1828680 times.
✗ Branch 3 not taken.
|
1828680 | if(!p_getwstr(&temp_meta.attributes_help[16+q],f)) |
| 13278 | ✗ | return qe_invalid; | |
| 13279 | 1828680 | } | |
| 13280 | 228585 | } | |
| 13281 | else | ||
| 13282 | { | ||
| 13283 |
3/4✓ Branch 0 taken 14069 times.
✓ Branch 1 taken 96 times.
✓ Branch 2 taken 14069 times.
✗ Branch 3 not taken.
|
14165 | if (!p_igetw(&num_meta_attrib, f)) |
| 13284 | ✗ | return qe_invalid; | |
| 13285 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14069 times.
|
14069 | if (num_meta_attrib > NUM_ZMETA_ATTRIBUTES) |
| 13286 | ✗ | return qe_invalid; | |
| 13287 |
2/2✓ Branch 0 taken 337656 times.
✓ Branch 1 taken 14069 times.
|
351725 | for(auto q = 0; q < num_meta_attrib; ++q) |
| 13288 | { | ||
| 13289 |
2/4✓ Branch 0 taken 337656 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 337656 times.
✗ Branch 3 not taken.
|
337656 | if(!p_getcstr(&temp_meta.attributes[q],f)) |
| 13290 | ✗ | return qe_invalid; | |
| 13291 |
2/4✓ Branch 0 taken 337656 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 337656 times.
✗ Branch 3 not taken.
|
337656 | if(!p_getwstr(&temp_meta.attributes_help[q],f)) |
| 13292 | ✗ | return qe_invalid; | |
| 13293 | 337656 | } | |
| 13294 | } | ||
| 13295 | |||
| 13296 |
2/2✓ Branch 0 taken 3882464 times.
✓ Branch 1 taken 242654 times.
|
4125118 | for(auto q = 0; q < 16; ++q) |
| 13297 | { | ||
| 13298 |
2/4✓ Branch 0 taken 3882464 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3882464 times.
✗ Branch 3 not taken.
|
3882464 | if(!p_getcstr(&temp_meta.usrflags[q],f)) |
| 13299 | ✗ | return qe_invalid; | |
| 13300 |
2/4✓ Branch 0 taken 3882464 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3882464 times.
✗ Branch 3 not taken.
|
3882464 | if(!p_getwstr(&temp_meta.usrflags_help[q],f)) |
| 13301 | ✗ | return qe_invalid; | |
| 13302 | 3882464 | } | |
| 13303 |
1/3✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 242654 times.
|
242846 | } |
| 13304 | |||
| 13305 |
2/2✓ Branch 0 taken 242654 times.
✓ Branch 1 taken 17985 times.
|
260639 | if(zmeta_version > 3) |
| 13306 | { | ||
| 13307 |
2/2✓ Branch 0 taken 1941232 times.
✓ Branch 1 taken 242654 times.
|
2183886 | for(auto q = 0; q < 8; ++q) |
| 13308 | { | ||
| 13309 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1941232 times.
|
1941232 | if(!p_getcstr(&temp_meta.initd[q],f)) |
| 13310 | ✗ | return qe_invalid; | |
| 13311 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1941232 times.
|
1941232 | if(!p_getwstr(&temp_meta.initd_help[q],f)) |
| 13312 | ✗ | return qe_invalid; | |
| 13313 | 1941232 | } | |
| 13314 |
2/2✓ Branch 0 taken 1941232 times.
✓ Branch 1 taken 242654 times.
|
2183886 | for(auto q = 0; q < 8; ++q) |
| 13315 | { | ||
| 13316 |
1/2✓ Branch 0 taken 1941232 times.
✗ Branch 1 not taken.
|
1941232 | if(!p_getc(&temp_meta.initd_type[q],f)) |
| 13317 | ✗ | return qe_invalid; | |
| 13318 | 1941232 | } | |
| 13319 | 242654 | } | |
| 13320 | else | ||
| 13321 | { | ||
| 13322 |
2/2✓ Branch 0 taken 143880 times.
✓ Branch 1 taken 17985 times.
|
161865 | for(auto q = 0; q < 8; ++q) |
| 13323 | 143880 | temp_meta.initd[q] = temp_meta.run_idens[q]; | |
| 13324 | } | ||
| 13325 | |||
| 13326 | 260639 | return 0; | |
| 13327 | 260831 | } | |
| 13328 | 1132643 | int32_t read_one_ffscript(PACKFILE *f, zquestheader *, int32_t script_index, word s_version, script_data *script, word zmeta_version) | |
| 13329 | { | ||
| 13330 | ASSERT(script); | ||
| 13331 |
2/2✓ Branch 0 taken 562399 times.
✓ Branch 1 taken 570244 times.
|
1132643 | if(s_version < 27) |
| 13332 | 562399 | return read_old_ffscript(f, script_index, s_version, script, zmeta_version); | |
| 13333 | |||
| 13334 | char exists; | ||
| 13335 |
1/2✓ Branch 0 taken 570244 times.
✗ Branch 1 not taken.
|
570244 | if (!p_getc(&exists, f)) |
| 13336 | ✗ | return qe_invalid; | |
| 13337 |
2/2✓ Branch 0 taken 6840 times.
✓ Branch 1 taken 563404 times.
|
570244 | if (!exists) |
| 13338 | { | ||
| 13339 | 563404 | script->disable(); | |
| 13340 | 563404 | return 0; | |
| 13341 | } | ||
| 13342 | |||
| 13343 | //Read meta | ||
| 13344 | { | ||
| 13345 | 6840 | zasm_meta temp_meta; | |
| 13346 |
2/4✓ Branch 0 taken 6840 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6840 times.
|
6840 | if (auto ret = read_one_zmeta(f, temp_meta, zmeta_version)) |
| 13347 | ✗ | return ret; | |
| 13348 |
1/2✓ Branch 0 taken 6840 times.
✗ Branch 1 not taken.
|
6840 | script->meta = temp_meta; |
| 13349 |
1/3✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 6840 times.
|
6840 | } |
| 13350 |
1/2✓ Branch 0 taken 6840 times.
✗ Branch 1 not taken.
|
6840 | if(!p_igetl(&script->pc, f)) |
| 13351 | ✗ | return qe_invalid; | |
| 13352 |
1/2✓ Branch 0 taken 6840 times.
✗ Branch 1 not taken.
|
6840 | if(!p_igetl(&script->end_pc, f)) |
| 13353 | ✗ | return qe_invalid; | |
| 13354 | |||
| 13355 |
1/2✓ Branch 0 taken 6840 times.
✗ Branch 1 not taken.
|
6840 | if (script == &fake_script_data) |
| 13356 | ✗ | return 0; | |
| 13357 | |||
| 13358 |
1/2✓ Branch 0 taken 6840 times.
✗ Branch 1 not taken.
|
6840 | assert(zasm_scripts.size() == 1); |
| 13359 | 6840 | auto& zs = zasm_scripts[0]; | |
| 13360 | 6840 | script->zasm_script = zs; | |
| 13361 | |||
| 13362 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6840 times.
|
6840 | if (script->valid()) |
| 13363 | { | ||
| 13364 | 6840 | zs->script_datas.push_back(script); | |
| 13365 | 6840 | read_scripts.push_back(script); | |
| 13366 | 6840 | } | |
| 13367 | |||
| 13368 | 6840 | return 0; | |
| 13369 | 1132643 | } | |
| 13370 | |||
| 13371 | 562399 | int32_t read_old_ffscript(PACKFILE *f, int32_t script_index, word s_version, script_data *script, word zmeta_version) | |
| 13372 | { | ||
| 13373 | 562399 | int32_t num_commands=1000; | |
| 13374 | |||
| 13375 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 562399 times.
|
562399 | if(s_version>=2) |
| 13376 | { | ||
| 13377 |
1/2✓ Branch 0 taken 562399 times.
✗ Branch 1 not taken.
|
562399 | if(!p_igetl(&num_commands,f)) |
| 13378 | { | ||
| 13379 | ✗ | return qe_invalid; | |
| 13380 | } | ||
| 13381 | 562399 | } | |
| 13382 | |||
| 13383 | #ifdef ZC_FUZZ | ||
| 13384 | const int32_t command_limit = 300000; | ||
| 13385 | #else | ||
| 13386 | 562399 | const int32_t command_limit = 10000000; | |
| 13387 | #endif | ||
| 13388 |
2/4✓ Branch 0 taken 562399 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 562399 times.
|
562399 | if (num_commands < 0 || num_commands > command_limit) |
| 13389 | { | ||
| 13390 | ✗ | return qe_invalid; | |
| 13391 | } | ||
| 13392 | |||
| 13393 | 562399 | std::vector<ffscript> zasm; | |
| 13394 |
1/2✓ Branch 0 taken 562399 times.
✗ Branch 1 not taken.
|
562399 | zasm.reserve(num_commands); |
| 13395 | |||
| 13396 |
2/2✓ Branch 0 taken 253799 times.
✓ Branch 1 taken 308600 times.
|
562399 | if(s_version >= 16) |
| 13397 | { | ||
| 13398 |
1/2✓ Branch 0 taken 253799 times.
✗ Branch 1 not taken.
|
253799 | zasm_meta temp_meta; |
| 13399 |
2/4✓ Branch 0 taken 253799 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 253799 times.
✗ Branch 3 not taken.
|
253799 | if (auto ret = read_one_zmeta(f, temp_meta, zmeta_version)) |
| 13400 | ✗ | return ret; | |
| 13401 |
1/2✓ Branch 0 taken 253799 times.
✗ Branch 1 not taken.
|
253799 | script->meta = temp_meta; |
| 13402 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 253799 times.
✓ Branch 2 taken 308600 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 308600 times.
✗ Branch 5 not taken.
|
562399 | } else script->meta = {}; |
| 13403 | |||
| 13404 |
2/2✓ Branch 0 taken 74674 times.
✓ Branch 1 taken 106043960 times.
|
106118634 | for(int32_t j=0; j<num_commands; j++) |
| 13405 | { | ||
| 13406 |
1/2✓ Branch 0 taken 106043960 times.
✗ Branch 1 not taken.
|
106043960 | auto& sc = zasm.emplace_back(); |
| 13407 |
2/4✓ Branch 0 taken 106043960 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 106043960 times.
✗ Branch 3 not taken.
|
106043960 | if(!p_igetw(&sc.command,f)) |
| 13408 | { | ||
| 13409 | ✗ | return qe_invalid; | |
| 13410 | } | ||
| 13411 | |||
| 13412 |
2/2✓ Branch 0 taken 105556235 times.
✓ Branch 1 taken 487725 times.
|
106043960 | if(sc.command == 0xFFFF) |
| 13413 | 487725 | break; | |
| 13414 | else | ||
| 13415 | { | ||
| 13416 |
2/4✓ Branch 0 taken 105556235 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 105556235 times.
✗ Branch 3 not taken.
|
105556235 | if(!p_igetl(&sc.arg1,f)) |
| 13417 | { | ||
| 13418 | ✗ | return qe_invalid; | |
| 13419 | } | ||
| 13420 | |||
| 13421 |
2/4✓ Branch 0 taken 105556235 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 105556235 times.
✗ Branch 3 not taken.
|
105556235 | if(!p_igetl(&sc.arg2,f)) |
| 13422 | { | ||
| 13423 | ✗ | return qe_invalid; | |
| 13424 | } | ||
| 13425 | |||
| 13426 |
2/2✓ Branch 0 taken 1047747 times.
✓ Branch 1 taken 104508488 times.
|
105556235 | if(s_version >= 24) |
| 13427 |
2/4✓ Branch 0 taken 1047747 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1047747 times.
✗ Branch 3 not taken.
|
1047747 | if(!p_igetl(&sc.arg3,f)) |
| 13428 | ✗ | return qe_invalid; | |
| 13429 | |||
| 13430 |
2/2✓ Branch 0 taken 8222037 times.
✓ Branch 1 taken 97334198 times.
|
105556235 | if(s_version >= 21) |
| 13431 | { | ||
| 13432 | 8222037 | uint32_t sz = 0; | |
| 13433 |
2/4✓ Branch 0 taken 8222037 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8222037 times.
✗ Branch 3 not taken.
|
8222037 | if(!p_igetl(&sz,f)) |
| 13434 | { | ||
| 13435 | ✗ | return qe_invalid; | |
| 13436 | } | ||
| 13437 |
2/2✓ Branch 0 taken 19400 times.
✓ Branch 1 taken 8202637 times.
|
8222037 | if(sz) //string found |
| 13438 | { | ||
| 13439 |
1/2✓ Branch 0 taken 19400 times.
✗ Branch 1 not taken.
|
19400 | sc.strptr = new std::string(); |
| 13440 | char dummy; | ||
| 13441 |
2/2✓ Branch 0 taken 1165008 times.
✓ Branch 1 taken 19400 times.
|
1184408 | for(size_t q = 0; q < sz; ++q) |
| 13442 | { | ||
| 13443 |
2/4✓ Branch 0 taken 1165008 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1165008 times.
✗ Branch 3 not taken.
|
1165008 | if(!p_getc(&dummy,f)) |
| 13444 | { | ||
| 13445 | ✗ | return qe_invalid; | |
| 13446 | } | ||
| 13447 |
1/2✓ Branch 0 taken 1165008 times.
✗ Branch 1 not taken.
|
1165008 | sc.strptr->push_back(dummy); |
| 13448 | 1165008 | } | |
| 13449 | 19400 | } | |
| 13450 |
2/4✓ Branch 0 taken 8222037 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8222037 times.
✗ Branch 3 not taken.
|
8222037 | if(!p_igetl(&sz,f)) |
| 13451 | { | ||
| 13452 | ✗ | return qe_invalid; | |
| 13453 | } | ||
| 13454 |
2/2✓ Branch 0 taken 933 times.
✓ Branch 1 taken 8221104 times.
|
8222037 | if(sz) //vector found |
| 13455 | { | ||
| 13456 |
1/2✓ Branch 0 taken 933 times.
✗ Branch 1 not taken.
|
933 | sc.vecptr = new std::vector<int32_t>(); |
| 13457 | int32_t dummy; | ||
| 13458 |
2/2✓ Branch 0 taken 11526 times.
✓ Branch 1 taken 933 times.
|
12459 | for(size_t q = 0; q < sz; ++q) |
| 13459 | { | ||
| 13460 |
2/4✓ Branch 0 taken 11526 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11526 times.
✗ Branch 3 not taken.
|
11526 | if(!p_igetl(&dummy,f)) |
| 13461 | { | ||
| 13462 | ✗ | return qe_invalid; | |
| 13463 | } | ||
| 13464 |
1/2✓ Branch 0 taken 11526 times.
✗ Branch 1 not taken.
|
11526 | sc.vecptr->push_back(dummy); |
| 13465 | 11526 | } | |
| 13466 | 933 | } | |
| 13467 | 8222037 | } | |
| 13468 | } | ||
| 13469 | 105556235 | } | |
| 13470 | |||
| 13471 |
2/2✓ Branch 0 taken 494047 times.
✓ Branch 1 taken 68352 times.
|
562399 | if (script == &fake_script_data) |
| 13472 | 68352 | return 0; | |
| 13473 | |||
| 13474 | // If the first command is unknown, invalidate the whole thing. | ||
| 13475 | // Saw this for https://www.purezc.net/index.php?page=quests&id=411 hero script 0 | ||
| 13476 |
5/6✓ Branch 0 taken 424749 times.
✓ Branch 1 taken 69298 times.
✓ Branch 2 taken 412772 times.
✓ Branch 3 taken 11977 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 412772 times.
|
494047 | if (!zasm.empty() && zasm[0].command >= NUMCOMMANDS && zasm[0].command != 0xFFFF) |
| 13477 | { | ||
| 13478 | ✗ | al_trace("Warning: found script with bad instruction, disabling script: %s %d\n", ScriptTypeToString(script->id.type), script->id.index); | |
| 13479 | ✗ | zasm.clear(); | |
| 13480 | ✗ | } | |
| 13481 | |||
| 13482 | 494047 | zasm_script_id id = zasm_scripts.size(); | |
| 13483 |
3/6✓ Branch 0 taken 494047 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 494047 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 494047 times.
✗ Branch 5 not taken.
|
494047 | auto& zs = zasm_scripts.emplace_back(std::make_shared<zasm_script>(id, script->name(), std::move(zasm))); |
| 13484 | 494047 | script->zasm_script = zs; | |
| 13485 | 494047 | script->pc = 0; | |
| 13486 | 494047 | script->end_pc = zs->size; | |
| 13487 |
3/4✓ Branch 0 taken 494047 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11977 times.
✓ Branch 3 taken 482070 times.
|
494047 | if (script->valid()) |
| 13488 | { | ||
| 13489 |
1/2✓ Branch 0 taken 11977 times.
✗ Branch 1 not taken.
|
11977 | zs->script_datas.push_back(script); |
| 13490 |
1/2✓ Branch 0 taken 11977 times.
✗ Branch 1 not taken.
|
11977 | read_scripts.push_back(script); |
| 13491 | 11977 | } | |
| 13492 | |||
| 13493 | 494047 | return 0; | |
| 13494 | 562399 | } | |
| 13495 | |||
| 13496 | extern SAMPLE customsfxdata[WAV_COUNT]; | ||
| 13497 | extern uint8_t customsfxflag[WAV_COUNT>>3]; | ||
| 13498 | extern int32_t sfxdat; | ||
| 13499 | extern DATAFILE *sfxdata; | ||
| 13500 | const char *old_sfx_string[Z35] = | ||
| 13501 | { | ||
| 13502 | "Arrow", "Sword beam", "Bomb blast", "Boomerang", "Subscreen cursor", | ||
| 13503 | "Shield is hit", "Item chime", "Roar (Dodongo, Gohma)", "Shutter", "Enemy dies", | ||
| 13504 | "Enemy is hit", "Low hearts warning", "Fire", "Ganon's fanfare", "Boss is hit", "Hammer", | ||
| 13505 | "Hookshot", "Message", "Hero is hit", "Item fanfare", "Bomb placed", "Item pickup", | ||
| 13506 | "Refill", "Roar (Aquamentus, Gleeok, Ganon)", "Item pickup 2", "Ocean ambience", | ||
| 13507 | "Secret chime", "Hero dies", "Stairs", "Sword", "Roar (Manhandla, Digdogger, Patra)", | ||
| 13508 | "Wand magic", "Whistle", "Zelda's fanfare", "Charging weapon", "Charging weapon 2", | ||
| 13509 | "Divine Fire", "Enemy falls from ceiling", "Divine Escape", "Fireball", "Tall Grass slashed", | ||
| 13510 | "Pound pounded", "Hover Boots", "Ice magic", "Jump", "Lens of Truth off", "Lens of Truth on", | ||
| 13511 | "Divine Protection shield", "Divine Protection 2", "Push block", "Rock", "Spell rocket down", | ||
| 13512 | "Spell rocket up", "Sword spin attack", "Splash", "Summon magic", "Sword tapping", | ||
| 13513 | "Sword tapping (secret)", "Whistle whirlwind", "Cane of Byrna orbit" | ||
| 13514 | }; | ||
| 13515 | char *sfx_string[WAV_COUNT]; | ||
| 13516 | |||
| 13517 | 415 | int32_t readsfx(PACKFILE *f, zquestheader *Header) | |
| 13518 | { | ||
| 13519 | //these are here to bypass compiler warnings about unused arguments | ||
| 13520 | 415 | Header=Header; | |
| 13521 | |||
| 13522 | int32_t dummy; | ||
| 13523 | 415 | word s_version=0; | |
| 13524 | //int32_t ret; | ||
| 13525 | 415 | SAMPLE temp_sample = {}; | |
| 13526 | 415 | temp_sample.loop_start=0; | |
| 13527 | 415 | temp_sample.loop_end=0; | |
| 13528 | 415 | temp_sample.param=0; | |
| 13529 | |||
| 13530 | //section version info | ||
| 13531 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if(!p_igetw(&s_version,f)) |
| 13532 | { | ||
| 13533 | ✗ | return qe_invalid; | |
| 13534 | } | ||
| 13535 | |||
| 13536 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if (s_version > V_SFX) |
| 13537 | ✗ | return qe_version; | |
| 13538 | |||
| 13539 | 415 | FFCore.quest_format[vSFX] = s_version; | |
| 13540 | |||
| 13541 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(!read_deprecated_section_cversion(f)) |
| 13542 | { | ||
| 13543 | ✗ | return qe_invalid; | |
| 13544 | } | ||
| 13545 | |||
| 13546 | //section size | ||
| 13547 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(!p_igetl(&dummy,f)) |
| 13548 | { | ||
| 13549 | ✗ | return qe_invalid; | |
| 13550 | } | ||
| 13551 | |||
| 13552 | /* HIGHLY UNORTHODOX UPDATING THING, by L | ||
| 13553 | * This fixes quests made before revision 411 (such as the 'Lost Isle Build'), | ||
| 13554 | * where the meaning of GOTOLESS changed. It also coincided with V_SFX | ||
| 13555 | * changing from 1 to 2. | ||
| 13556 | */ | ||
| 13557 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(s_version < 2) |
| 13558 | ✗ | set_qr(qr_GOTOLESSNOTEQUAL,1); | |
| 13559 | |||
| 13560 | /* End highly unorthodox updating thing */ | ||
| 13561 | |||
| 13562 | 415 | int32_t wavcount = WAV_COUNT; | |
| 13563 | |||
| 13564 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(s_version < 6) |
| 13565 | ✗ | wavcount = 128; | |
| 13566 | |||
| 13567 | uint8_t tempflag[WAV_COUNT>>3]; | ||
| 13568 | |||
| 13569 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if(s_version < 4) |
| 13570 | { | ||
| 13571 | ✗ | memset(tempflag, 0xFF, WAV_COUNT>>3); | |
| 13572 | ✗ | } | |
| 13573 | else | ||
| 13574 | { | ||
| 13575 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(s_version < 6) |
| 13576 | ✗ | memset(tempflag, 0, WAV_COUNT>>3); | |
| 13577 | |||
| 13578 |
2/2✓ Branch 0 taken 13280 times.
✓ Branch 1 taken 415 times.
|
13695 | for(int32_t i=0; i<(wavcount>>3); i++) |
| 13579 | { | ||
| 13580 | 13280 | p_getc(&tempflag[i], f); | |
| 13581 | 13280 | } | |
| 13582 | |||
| 13583 | } | ||
| 13584 | |||
| 13585 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(s_version>4) |
| 13586 | { | ||
| 13587 |
2/2✓ Branch 0 taken 105825 times.
✓ Branch 1 taken 415 times.
|
106240 | for(int32_t i=1; i<WAV_COUNT; i++) |
| 13588 | { | ||
| 13589 | 105825 | sprintf(sfx_string[i],"s%03d",i); | |
| 13590 | |||
| 13591 |
2/2✓ Branch 0 taken 80925 times.
✓ Branch 1 taken 24900 times.
|
105825 | if((i<Z35)) |
| 13592 | 24900 | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13593 | |||
| 13594 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 105825 times.
|
105825 | if(i>=wavcount) |
| 13595 | ✗ | continue; | |
| 13596 |
2/2✓ Branch 0 taken 23150 times.
✓ Branch 1 taken 82675 times.
|
105825 | if(get_bit(tempflag, i-1)) |
| 13597 | { | ||
| 13598 | char tempname[36]; | ||
| 13599 | |||
| 13600 |
1/2✓ Branch 0 taken 23150 times.
✗ Branch 1 not taken.
|
23150 | if(!pfread(tempname, 36, f)) |
| 13601 | { | ||
| 13602 | ✗ | return qe_invalid; | |
| 13603 | } | ||
| 13604 | |||
| 13605 | 23150 | sfx_string[i][0] = '\0'; | |
| 13606 | 23150 | strncat(sfx_string[i], tempname, 36 - 1); | |
| 13607 | 23150 | } | |
| 13608 | else | ||
| 13609 | { | ||
| 13610 | 82675 | sprintf(sfx_string[i],"s%03d",i); | |
| 13611 | |||
| 13612 |
2/2✓ Branch 0 taken 72985 times.
✓ Branch 1 taken 9690 times.
|
82675 | if(i<Z35) |
| 13613 | 9690 | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13614 | 82675 | sfx_string[i][35] = 0; //Force NULL Termination | |
| 13615 | } | ||
| 13616 | 105825 | } | |
| 13617 | 415 | } | |
| 13618 | else | ||
| 13619 | { | ||
| 13620 | ✗ | for(int32_t i=1; i<WAV_COUNT; i++) | |
| 13621 | { | ||
| 13622 | ✗ | sprintf(sfx_string[i],"s%03d",i); | |
| 13623 | |||
| 13624 | ✗ | if(i<Z35) | |
| 13625 | ✗ | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13626 | ✗ | } | |
| 13627 | } | ||
| 13628 | |||
| 13629 | //finally... section data | ||
| 13630 |
2/2✓ Branch 0 taken 105825 times.
✓ Branch 1 taken 415 times.
|
106240 | for(int32_t i=1; i<wavcount; i++) |
| 13631 | { | ||
| 13632 |
2/2✓ Branch 0 taken 23150 times.
✓ Branch 1 taken 82675 times.
|
105825 | if(get_bit(tempflag, i-1)) |
| 13633 | { | ||
| 13634 | |||
| 13635 |
1/2✓ Branch 0 taken 23150 times.
✗ Branch 1 not taken.
|
23150 | if(!p_igetl(&dummy,f)) |
| 13636 | { | ||
| 13637 | ✗ | return qe_invalid; | |
| 13638 | } | ||
| 13639 | |||
| 13640 | 23150 | (temp_sample.bits) = dummy; | |
| 13641 | |||
| 13642 |
1/2✓ Branch 0 taken 23150 times.
✗ Branch 1 not taken.
|
23150 | if(!p_igetl(&dummy,f)) |
| 13643 | { | ||
| 13644 | ✗ | return qe_invalid; | |
| 13645 | } | ||
| 13646 | |||
| 13647 | 23150 | (temp_sample.stereo) = dummy; | |
| 13648 | |||
| 13649 |
1/2✓ Branch 0 taken 23150 times.
✗ Branch 1 not taken.
|
23150 | if(!p_igetl(&dummy,f)) |
| 13650 | { | ||
| 13651 | ✗ | return qe_invalid; | |
| 13652 | } | ||
| 13653 | |||
| 13654 | 23150 | (temp_sample.freq) = dummy; | |
| 13655 | |||
| 13656 |
1/2✓ Branch 0 taken 23150 times.
✗ Branch 1 not taken.
|
23150 | if(!p_igetl(&dummy,f)) |
| 13657 | { | ||
| 13658 | ✗ | return qe_invalid; | |
| 13659 | } | ||
| 13660 | |||
| 13661 | 23150 | (temp_sample.priority) = dummy; | |
| 13662 | |||
| 13663 |
1/2✓ Branch 0 taken 23150 times.
✗ Branch 1 not taken.
|
23150 | if(!p_igetl(&(temp_sample.len),f)) |
| 13664 | { | ||
| 13665 | ✗ | return qe_invalid; | |
| 13666 | } | ||
| 13667 | |||
| 13668 |
1/2✓ Branch 0 taken 23150 times.
✗ Branch 1 not taken.
|
23150 | if(!p_igetl(&(temp_sample.loop_start),f)) |
| 13669 | { | ||
| 13670 | ✗ | return qe_invalid; | |
| 13671 | } | ||
| 13672 | |||
| 13673 |
1/2✓ Branch 0 taken 23150 times.
✗ Branch 1 not taken.
|
23150 | if(!p_igetl(&(temp_sample.loop_end),f)) |
| 13674 | { | ||
| 13675 | ✗ | return qe_invalid; | |
| 13676 | } | ||
| 13677 | |||
| 13678 |
1/2✓ Branch 0 taken 23150 times.
✗ Branch 1 not taken.
|
23150 | if(!p_igetl(&(temp_sample.param),f)) |
| 13679 | { | ||
| 13680 | ✗ | return qe_invalid; | |
| 13681 | } | ||
| 13682 | |||
| 13683 | 23150 | auto len = (temp_sample.bits==8?1:2)*(temp_sample.stereo==0?1:2)*temp_sample.len; | |
| 13684 | #ifdef ZC_FUZZ | ||
| 13685 | const int32_t sfx_limit = 100000; | ||
| 13686 | if (len < 0 || len > sfx_limit) | ||
| 13687 | { | ||
| 13688 | return qe_invalid; | ||
| 13689 | } | ||
| 13690 | #endif | ||
| 13691 | 23150 | temp_sample.data = calloc(len,1); | |
| 13692 | |||
| 13693 |
1/2✓ Branch 0 taken 23150 times.
✗ Branch 1 not taken.
|
23150 | if(s_version < 3) |
| 13694 | ✗ | len = (temp_sample.bits==8?1:2)*temp_sample.len; | |
| 13695 | |||
| 13696 | //old-style, non-portable loading (Bad Allegro! Bad!!) -DD | ||
| 13697 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 23150 times.
|
23150 | if(s_version < 2) |
| 13698 | { | ||
| 13699 | ✗ | if(!pfread(temp_sample.data, len,f)) | |
| 13700 | { | ||
| 13701 | ✗ | return qe_invalid; | |
| 13702 | } | ||
| 13703 | ✗ | } | |
| 13704 | else | ||
| 13705 | { | ||
| 13706 | //re-endianfy the data | ||
| 13707 | 23150 | int32_t wordstoread = len / sizeof(word); | |
| 13708 | |||
| 13709 |
2/2✓ Branch 0 taken 669182603 times.
✓ Branch 1 taken 23150 times.
|
669205753 | for(int32_t j=0; j<wordstoread; j++) |
| 13710 | { | ||
| 13711 | word temp; | ||
| 13712 | |||
| 13713 |
1/2✓ Branch 0 taken 669182603 times.
✗ Branch 1 not taken.
|
669182603 | if(!p_igetw(&temp, f)) |
| 13714 | { | ||
| 13715 | ✗ | return qe_invalid; | |
| 13716 | } | ||
| 13717 | |||
| 13718 | 669182603 | ((word *)temp_sample.data)[j] = temp; | |
| 13719 | 669182603 | } | |
| 13720 | } | ||
| 13721 | 23150 | } | |
| 13722 |
2/2✓ Branch 0 taken 9690 times.
✓ Branch 1 taken 72985 times.
|
82675 | else if(i < Z35) |
| 13723 | { | ||
| 13724 | 9690 | SAMPLE* datsamp = (SAMPLE*)(sfxdata[i].dat); | |
| 13725 | 9690 | memcpy(&temp_sample, datsamp, sizeof(SAMPLE)); | |
| 13726 | 9690 | set_bit(tempflag, i-1, 1); | |
| 13727 | 9690 | int32_t len = (temp_sample.bits==8?1:2)*(temp_sample.stereo==0?1:2)*temp_sample.len; | |
| 13728 | 9690 | temp_sample.data = calloc(len,1); | |
| 13729 | 9690 | memcpy(temp_sample.data, datsamp->data, len); | |
| 13730 | 9690 | } | |
| 13731 | 72985 | else continue; | |
| 13732 | |||
| 13733 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32840 times.
|
32840 | if(customsfxdata[i].data!=NULL) |
| 13734 | { | ||
| 13735 | // delete [] customsfxdata[i].data; | ||
| 13736 | 32840 | free(customsfxdata[i].data); | |
| 13737 | 32840 | } | |
| 13738 | |||
| 13739 | // customsfxdata[i].data = new byte[(temp_sample.bits==8?1:2)*temp_sample.len]; | ||
| 13740 | 32840 | int32_t len2 = (temp_sample.bits==8?1:2)*(temp_sample.stereo==0?1:2)*temp_sample.len; | |
| 13741 | 32840 | customsfxdata[i].data = calloc(len2,1); | |
| 13742 | 32840 | customsfxdata[i].bits = temp_sample.bits; | |
| 13743 | 32840 | customsfxdata[i].stereo = temp_sample.stereo; | |
| 13744 | 32840 | customsfxdata[i].freq = temp_sample.freq; | |
| 13745 | 32840 | customsfxdata[i].priority = temp_sample.priority; | |
| 13746 | 32840 | customsfxdata[i].len = temp_sample.len; | |
| 13747 | 32840 | customsfxdata[i].loop_start = temp_sample.loop_start; | |
| 13748 | 32840 | customsfxdata[i].loop_end = temp_sample.loop_end; | |
| 13749 | 32840 | customsfxdata[i].param = temp_sample.param; | |
| 13750 | 32840 | int32_t cpylen = len2; | |
| 13751 | |||
| 13752 |
1/2✓ Branch 0 taken 32840 times.
✗ Branch 1 not taken.
|
32840 | if(s_version<3) |
| 13753 | { | ||
| 13754 | ✗ | cpylen = (temp_sample.bits==8?1:2)*temp_sample.len; | |
| 13755 | ✗ | al_trace("WARNING: Quest SFX %d is in stereo, and may be corrupt.\n",i); | |
| 13756 | ✗ | } | |
| 13757 | |||
| 13758 | 32840 | memcpy(customsfxdata[i].data,temp_sample.data,cpylen); | |
| 13759 | |||
| 13760 | 32840 | free(temp_sample.data); | |
| 13761 | 32840 | } | |
| 13762 | |||
| 13763 | 415 | memcpy(customsfxflag, tempflag, WAV_COUNT>>3); | |
| 13764 | |||
| 13765 | 415 | sfxdat=0; | |
| 13766 | 415 | return 0; | |
| 13767 | 415 | } | |
| 13768 | |||
| 13769 | 496 | void setupsfx() | |
| 13770 | { | ||
| 13771 |
2/2✓ Branch 0 taken 126480 times.
✓ Branch 1 taken 496 times.
|
126976 | for(int32_t i=1; i<WAV_COUNT; i++) |
| 13772 | { | ||
| 13773 | 126480 | sprintf(sfx_string[i],"s%03d",i); | |
| 13774 | |||
| 13775 |
2/2✓ Branch 0 taken 96720 times.
✓ Branch 1 taken 29760 times.
|
126480 | if(i<Z35) |
| 13776 | { | ||
| 13777 | 29760 | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13778 | 29760 | } | |
| 13779 | |||
| 13780 | 126480 | memset(customsfxflag, 0, WAV_COUNT>>3); | |
| 13781 | |||
| 13782 | 126480 | int32_t j=i; | |
| 13783 | |||
| 13784 |
2/2✓ Branch 0 taken 30256 times.
✓ Branch 1 taken 96224 times.
|
126480 | if(i>Z35) |
| 13785 | { | ||
| 13786 | 96224 | i=Z35; | |
| 13787 | 96224 | } | |
| 13788 | |||
| 13789 | 126480 | SAMPLE *temp_sample = (SAMPLE *)sfxdata[i].dat; | |
| 13790 | |||
| 13791 |
2/2✓ Branch 0 taken 97410 times.
✓ Branch 1 taken 29070 times.
|
126480 | if(customsfxdata[j].data!=NULL) |
| 13792 | { | ||
| 13793 | // delete [] customsfxdata[j].data; | ||
| 13794 | 29070 | free(customsfxdata[j].data); | |
| 13795 | 29070 | } | |
| 13796 | |||
| 13797 | // customsfxdata[j].data = new byte[(temp_sample->bits==8?1:2)*temp_sample->len]; | ||
| 13798 | 126480 | customsfxdata[j].data = calloc((temp_sample->bits==8?1:2)*(temp_sample->stereo == 0 ? 1 : 2)*temp_sample->len,1); | |
| 13799 | 126480 | customsfxdata[j].bits = temp_sample->bits; | |
| 13800 | 126480 | customsfxdata[j].stereo = temp_sample->stereo; | |
| 13801 | 126480 | customsfxdata[j].freq = temp_sample->freq; | |
| 13802 | 126480 | customsfxdata[j].priority = temp_sample->priority; | |
| 13803 | 126480 | customsfxdata[j].len = temp_sample->len; | |
| 13804 | 126480 | customsfxdata[j].loop_start = temp_sample->loop_start; | |
| 13805 | 126480 | customsfxdata[j].loop_end = temp_sample->loop_end; | |
| 13806 | 126480 | customsfxdata[j].param = temp_sample->param; | |
| 13807 | 126480 | memcpy(customsfxdata[j].data, (temp_sample->data), (temp_sample->bits==8?1:2)*(temp_sample->stereo==0 ? 1 : 2)*temp_sample->len); | |
| 13808 | 126480 | i=j; | |
| 13809 | 126480 | } | |
| 13810 | 496 | } | |
| 13811 | |||
| 13812 | extern char *guy_string[eMAXGUYS]; | ||
| 13813 | extern const char *old_guy_string[OLDMAXGUYS]; | ||
| 13814 | |||
| 13815 | 496 | int32_t readguys(PACKFILE *f, zquestheader *Header) | |
| 13816 | { | ||
| 13817 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 23 times.
|
496 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_guys); |
| 13818 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 496 times.
|
496 | if (should_skip) return 0; |
| 13819 | |||
| 13820 | dword dummy; | ||
| 13821 | word guy_cversion; | ||
| 13822 | 496 | word guyversion=0; | |
| 13823 | |||
| 13824 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 473 times.
|
496 | if(Header->zelda_version >= 0x193) |
| 13825 | { | ||
| 13826 | //section version info | ||
| 13827 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetw(&guyversion,f)) |
| 13828 | { | ||
| 13829 | ✗ | return qe_invalid; | |
| 13830 | } | ||
| 13831 | |||
| 13832 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if (guyversion > V_GUYS) |
| 13833 | ✗ | return qe_version; | |
| 13834 | |||
| 13835 | 473 | FFCore.quest_format[vGuys] = guyversion; | |
| 13836 | |||
| 13837 | // Note: this is the only instance where "cversion" is ever used. | ||
| 13838 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetw(&guy_cversion,f)) |
| 13839 | { | ||
| 13840 | ✗ | return qe_invalid; | |
| 13841 | } | ||
| 13842 | |||
| 13843 | //section size | ||
| 13844 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetl(&dummy,f)) |
| 13845 | { | ||
| 13846 | ✗ | return qe_invalid; | |
| 13847 | } | ||
| 13848 | 473 | } | |
| 13849 | |||
| 13850 |
2/2✓ Branch 0 taken 415 times.
✓ Branch 1 taken 81 times.
|
496 | if(guyversion > 3) |
| 13851 | { | ||
| 13852 |
2/2✓ Branch 0 taken 212480 times.
✓ Branch 1 taken 415 times.
|
212895 | for(int32_t i=0; i<MAXGUYS; i++) |
| 13853 | { | ||
| 13854 | char tempname[64]; | ||
| 13855 | |||
| 13856 | // rev. 1511 : guyversion = 23. upped to 512 editable enemies. -Gleeok | ||
| 13857 | // if guyversion < 23 then there is only 256 enemies in the packfile, so default the rest. | ||
| 13858 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 212480 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
212480 | if(guyversion < 23 && i >= OLDBETAMAXGUYS) |
| 13859 | { | ||
| 13860 | ✗ | memset(tempname, 0, sizeof(char)*64); | |
| 13861 | ✗ | sprintf(tempname, "e%03d", i); | |
| 13862 | ✗ | strcpy(guy_string[i], tempname); | |
| 13863 | |||
| 13864 | ✗ | continue; | |
| 13865 | } | ||
| 13866 | |||
| 13867 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!pfread(tempname, 64, f)) |
| 13868 | { | ||
| 13869 | ✗ | return qe_invalid; | |
| 13870 | } | ||
| 13871 | |||
| 13872 | // Don't retain names of uneditable enemy entries! | ||
| 13873 | // for version upgrade to 2.5 | ||
| 13874 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 212480 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
212480 | if(guyversion < 23 && i >= 177) |
| 13875 | { | ||
| 13876 | // some of the older builds have names such as 'zz123', | ||
| 13877 | // (this order gets messed up with some eXXX and some zzXXX) | ||
| 13878 | // so let's update to the newer naming convection. -Gleeok | ||
| 13879 | char tmpbuf[64]; | ||
| 13880 | ✗ | memset(tmpbuf, 0, sizeof(char)*64); | |
| 13881 | ✗ | sprintf(tmpbuf, "zz%03d", i); | |
| 13882 | |||
| 13883 | ✗ | if(memcmp(tempname, tmpbuf, size_t(5)) == 0) | |
| 13884 | { | ||
| 13885 | ✗ | memset(tempname, 0, sizeof(char)*64); | |
| 13886 | ✗ | sprintf(tempname, "e%03d", i); | |
| 13887 | ✗ | } | |
| 13888 | ✗ | } | |
| 13889 | |||
| 13890 |
6/6✓ Branch 0 taken 73455 times.
✓ Branch 1 taken 139025 times.
✓ Branch 2 taken 69720 times.
✓ Branch 3 taken 3735 times.
✓ Branch 4 taken 61045 times.
✓ Branch 5 taken 8675 times.
|
212480 | if(i >= OLDMAXGUYS || strlen(tempname)<1 || tempname[strlen(tempname)-1]!=' ') |
| 13891 | { | ||
| 13892 | 203805 | guy_string[i][0] = '\0'; | |
| 13893 | 203805 | strncat(guy_string[i], tempname, 64 - 1); | |
| 13894 | 203805 | } | |
| 13895 | else | ||
| 13896 | { | ||
| 13897 | 8675 | strcpy(guy_string[i],old_guy_string[i]); | |
| 13898 | } | ||
| 13899 | 212480 | } | |
| 13900 | 415 | } | |
| 13901 | else | ||
| 13902 | { | ||
| 13903 |
2/2✓ Branch 0 taken 41472 times.
✓ Branch 1 taken 81 times.
|
41553 | for(int32_t i=0; i<eMAXGUYS; i++) |
| 13904 | { | ||
| 13905 | 41472 | sprintf(guy_string[i],"zz%03d",i); | |
| 13906 | 41472 | } | |
| 13907 | |||
| 13908 |
2/2✓ Branch 0 taken 14337 times.
✓ Branch 1 taken 81 times.
|
14418 | for(int32_t i=0; i<OLDMAXGUYS; i++) |
| 13909 | { | ||
| 13910 | 14337 | strcpy(guy_string[i],old_guy_string[i]); | |
| 13911 | 14337 | } | |
| 13912 | } | ||
| 13913 | |||
| 13914 | |||
| 13915 | //finally... section data | ||
| 13916 | 496 | init_guys(guyversion); //using default data for now... | |
| 13917 | |||
| 13918 | // Goriya guy fix | ||
| 13919 |
3/6✓ Branch 0 taken 415 times.
✓ Branch 1 taken 81 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 415 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
496 | if((Header->zelda_version < 0x211)||((Header->zelda_version == 0x211)&&(Header->build<7))) |
| 13920 | { | ||
| 13921 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 59 times.
|
81 | if(get_qr(qr_NEWENEMYTILES)) |
| 13922 | { | ||
| 13923 | 59 | guysbuf[gGORIYA].tile=130; | |
| 13924 | 59 | guysbuf[gGORIYA].e_tile=130; | |
| 13925 | 59 | } | |
| 13926 | 81 | } | |
| 13927 | |||
| 13928 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 23 times.
|
496 | if(Header->zelda_version < 0x193) |
| 13929 | { | ||
| 13930 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 5 times.
|
23 | if(get_bit(deprecated_rules,46)) |
| 13931 | { | ||
| 13932 | 5 | guysbuf[eDODONGO].cset=14; | |
| 13933 | 5 | guysbuf[eDODONGO].bosspal=spDIG; | |
| 13934 | 5 | } | |
| 13935 | 23 | } | |
| 13936 | // Not sure when this first changed, but it's necessary for 2.10, at least | ||
| 13937 | // @TODO: @BUG:1.92 - 1.84? Figure this out exactly for the final 2.50 release. | ||
| 13938 | //2.10 Fixes | ||
| 13939 |
3/6✓ Branch 0 taken 415 times.
✓ Branch 1 taken 81 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 415 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
496 | if((Header->zelda_version < 0x211)||((Header->zelda_version == 0x211)&&(Header->build<18))) |
| 13940 | { | ||
| 13941 | 81 | guysbuf[eWWIZ].editorflags |= ENEMY_FLAG5; | |
| 13942 | 81 | guysbuf[eMOLDORM].editorflags |= ENEMY_FLAG6; | |
| 13943 | 81 | guysbuf[eMANHAN].editorflags |= ENEMY_FLAG6; | |
| 13944 | 81 | guysbuf[eCENT1].attributes[2] = 1; | |
| 13945 | 81 | guysbuf[eCENT2].attributes[2] = 1; | |
| 13946 | 81 | } | |
| 13947 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 496 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
496 | if((Header->zelda_version <= 0x255) || (Header->zelda_version == 0x255 && Header->build < 47) ) |
| 13948 | { | ||
| 13949 | 496 | guysbuf[eWPOLSV].defense[edefWhistle] = ed1HKO; | |
| 13950 | 496 | } | |
| 13951 |
2/2✓ Branch 0 taken 415 times.
✓ Branch 1 taken 81 times.
|
496 | if(Header->zelda_version <= 0x210) |
| 13952 | { | ||
| 13953 | 81 | guysbuf[eGLEEOK1F].attributes[5] = 16; | |
| 13954 | 81 | guysbuf[eGLEEOK2F].attributes[5] = 16; | |
| 13955 | 81 | guysbuf[eGLEEOK3F].attributes[5] = 16; | |
| 13956 | 81 | guysbuf[eGLEEOK4F].attributes[5] = 16; | |
| 13957 | |||
| 13958 | 81 | guysbuf[eWIZ1].attributes[3] = 1; //only set the enemy that needs backward compat, not all of them. | |
| 13959 | 81 | guysbuf[eBATROBE].attributes[3] = 1; | |
| 13960 | //guysbuf[eSUMMONER].misc4 = 1; | ||
| 13961 | 81 | guysbuf[eWWIZ].attributes[3] = 1; | |
| 13962 | 81 | guysbuf[eDODONGO].deadsfx = 15; //In 2.10 and earlier, Dodongos used this as their death sound. | |
| 13963 | 81 | guysbuf[eDODONGOBS].deadsfx = 15; //In 2.10 and earlier, Dodongos used this as their death sound. | |
| 13964 | 81 | } | |
| 13965 |
2/2✓ Branch 0 taken 484 times.
✓ Branch 1 taken 12 times.
|
496 | if(Header->zelda_version == 0x190) |
| 13966 | { | ||
| 13967 | 12 | al_trace("Setting Tribble Properties for Version: %x", Header->zelda_version); | |
| 13968 | 12 | guysbuf[eKEESETRIB].attributes[2] = eVIRE; //1.90 and earlier, keese and gel tribbles grew up into | |
| 13969 | 12 | guysbuf[eGELTRIB].attributes[2] = eZOL; //normal vires, and zols -Z (16th January, 2019 ) | |
| 13970 | 12 | } | |
| 13971 | |||
| 13972 | // The versions here may not be correct | ||
| 13973 | // zelda_version>=0x211 handled at guyversion<24 | ||
| 13974 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 478 times.
|
496 | if(Header->zelda_version <= 0x190) |
| 13975 | { | ||
| 13976 | 18 | guysbuf[eCENT1].attributes[2] = 0; | |
| 13977 | 18 | guysbuf[eCENT2].attributes[2] = 0; | |
| 13978 | 18 | guysbuf[eMOLDORM].attributes[1] = 0; | |
| 13979 | //guysbuf[eKEESETRIB].misc3 = eVIRE; //1.90 and earlier, keese and gel tribbles grew up into | ||
| 13980 | //guysbuf[eGELTRIB].misc3 = eZOL; //normal vires, and zols -Z (16th January, 2019 ) | ||
| 13981 | 18 | } | |
| 13982 |
2/2✓ Branch 0 taken 415 times.
✓ Branch 1 taken 63 times.
|
478 | else if(Header->zelda_version <= 0x210) |
| 13983 | { | ||
| 13984 | 63 | guysbuf[eCENT1].attributes[2] = 1; | |
| 13985 | 63 | guysbuf[eCENT2].attributes[2] = 1; | |
| 13986 | 63 | guysbuf[eMOLDORM].attributes[1] = 0; | |
| 13987 | 63 | } | |
| 13988 | |||
| 13989 |
2/2✓ Branch 0 taken 415 times.
✓ Branch 1 taken 81 times.
|
496 | if ( Header->zelda_version < 0x211 ) //Default rest rates for phantom ghinis, peahats and keese in < 2.50 quests |
| 13990 | { | ||
| 13991 | 81 | guysbuf[eKEESE1].attributes[15] = 120; | |
| 13992 | 81 | guysbuf[eKEESE2].attributes[15] = 120; | |
| 13993 | 81 | guysbuf[eKEESE3].attributes[15] = 120; | |
| 13994 | 81 | guysbuf[eKEESETRIB].attributes[15] = 120; | |
| 13995 | 81 | guysbuf[eKEESE1].attributes[16] = 16; | |
| 13996 | 81 | guysbuf[eKEESE2].attributes[16] = 16; | |
| 13997 | 81 | guysbuf[eKEESE3].attributes[16] = 16; | |
| 13998 | 81 | guysbuf[eKEESETRIB].attributes[16] = 16; | |
| 13999 | |||
| 14000 | 81 | guysbuf[ePEAHAT].attributes[15] = 80; | |
| 14001 | 81 | guysbuf[ePEAHAT].attributes[16] = 16; | |
| 14002 | |||
| 14003 | 81 | guysbuf[eGHINI2].attributes[15] = 120; | |
| 14004 | 81 | guysbuf[eGHINI2].attributes[16] = 10; | |
| 14005 | |||
| 14006 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 66 times.
|
81 | if (replay_version_check(20)) |
| 14007 | { | ||
| 14008 | 66 | guysbuf[eGHINI2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14009 | 66 | guysbuf[eMOLDORM].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14010 | 66 | guysbuf[eKEESETRIB].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14011 | 66 | guysbuf[eKEESE3].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14012 | 66 | guysbuf[eKEESE2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14013 | 66 | guysbuf[eKEESE1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14014 | 66 | guysbuf[eTEK1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14015 | 66 | guysbuf[eTEK2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14016 | 66 | guysbuf[ePEAHAT].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14017 | 66 | guysbuf[eROCK].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14018 | 66 | guysbuf[eTRAP].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14019 | 66 | guysbuf[eWALLM].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14020 | 66 | guysbuf[ePOLSV].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14021 | 66 | guysbuf[eMANHAN].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14022 | 66 | guysbuf[eGLEEOK1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14023 | 66 | guysbuf[eGLEEOK2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14024 | 66 | guysbuf[eGLEEOK3].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14025 | 66 | guysbuf[eGLEEOK4].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14026 | 66 | guysbuf[eDIG1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14027 | 66 | guysbuf[eDIG3].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14028 | 66 | guysbuf[eDIGPUP1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14029 | 66 | guysbuf[eDIGPUP2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14030 | 66 | guysbuf[eDIGPUP3].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14031 | 66 | guysbuf[eDIGPUP4].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14032 | 66 | guysbuf[eRAQUAM].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14033 | 66 | guysbuf[eITEMFAIRY].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14034 | 66 | guysbuf[eFIRE].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14035 | 66 | guysbuf[eMANHAN2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14036 | 66 | guysbuf[eTRAP_H].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14037 | 66 | guysbuf[eTRAP_V].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14038 | 66 | guysbuf[eTRAP_LR].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14039 | 66 | guysbuf[eTRAP_UD].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14040 | 66 | guysbuf[ePATRA1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14041 | 66 | guysbuf[ePATRA2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14042 | 66 | guysbuf[ePATRABS].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14043 | 66 | guysbuf[eBAT].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14044 | 66 | guysbuf[eGLEEOK1F].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14045 | 66 | guysbuf[eGLEEOK2F].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14046 | 66 | guysbuf[eGLEEOK3F].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14047 | 66 | guysbuf[eGLEEOK4F].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14048 | 66 | guysbuf[eTRIGGER].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14049 | 66 | guysbuf[ePATRAL2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14050 | 66 | guysbuf[ePATRAL3].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14051 | 66 | guysbuf[eGOHMA1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14052 | 66 | guysbuf[eGOHMA2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14053 | 66 | guysbuf[eGOHMA3].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14054 | 66 | guysbuf[eGOHMA4].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14055 | 66 | guysbuf[eMPOLSV].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14056 | 66 | guysbuf[eWPOLSV].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 14057 | 66 | } | |
| 14058 | 81 | } | |
| 14059 | |||
| 14060 | |||
| 14061 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 415 times.
|
496 | if(guyversion<=2) |
| 14062 | { | ||
| 14063 | 81 | return readherosprites2(f, guyversion==2?0:-1); | |
| 14064 | } | ||
| 14065 | |||
| 14066 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if(guyversion > 3) |
| 14067 | { | ||
| 14068 | 415 | guydata tempguy; | |
| 14069 | |||
| 14070 |
2/2✓ Branch 0 taken 212480 times.
✓ Branch 1 taken 415 times.
|
212895 | for(int32_t i=0; i<MAXGUYS; i++) |
| 14071 | { | ||
| 14072 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(guyversion < 23) // May 2012 : 512 max enemies |
| 14073 | { | ||
| 14074 | ✗ | if(i >= OLDBETAMAXGUYS) | |
| 14075 | { | ||
| 14076 | ✗ | guysbuf[i].clear(); | |
| 14077 | ✗ | continue; | |
| 14078 | } | ||
| 14079 | ✗ | } | |
| 14080 | |||
| 14081 | 212480 | tempguy.clear(); | |
| 14082 | |||
| 14083 | uint32_t flags1; | ||
| 14084 | uint32_t flags2; | ||
| 14085 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetl(&(flags1),f)) |
| 14086 | { | ||
| 14087 | ✗ | return qe_invalid; | |
| 14088 | } | ||
| 14089 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetl(&(flags2),f)) |
| 14090 | { | ||
| 14091 | ✗ | return qe_invalid; | |
| 14092 | } | ||
| 14093 | 212480 | tempguy.flags = guy_flags(flags1) | guy_flags(uint64_t(flags2)<<32ULL); | |
| 14094 | |||
| 14095 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
|
212480 | if ( guyversion >= 36 ) //expanded tiles |
| 14096 | { | ||
| 14097 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.tile),f)) |
| 14098 | { | ||
| 14099 | ✗ | return qe_invalid; | |
| 14100 | } | ||
| 14101 | 110080 | } | |
| 14102 | else | ||
| 14103 | { | ||
| 14104 |
1/2✓ Branch 0 taken 102400 times.
✗ Branch 1 not taken.
|
102400 | if(!p_igetw(&(tempguy.tile),f)) |
| 14105 | { | ||
| 14106 | ✗ | return qe_invalid; | |
| 14107 | } | ||
| 14108 | } | ||
| 14109 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_getc(&(tempguy.width),f)) |
| 14110 | { | ||
| 14111 | ✗ | return qe_invalid; | |
| 14112 | } | ||
| 14113 | |||
| 14114 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_getc(&(tempguy.height),f)) |
| 14115 | { | ||
| 14116 | ✗ | return qe_invalid; | |
| 14117 | } | ||
| 14118 | |||
| 14119 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
|
212480 | if ( guyversion >= 36 ) //expanded tiles |
| 14120 | { | ||
| 14121 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.s_tile),f)) |
| 14122 | { | ||
| 14123 | ✗ | return qe_invalid; | |
| 14124 | } | ||
| 14125 | 110080 | } | |
| 14126 | else | ||
| 14127 | { | ||
| 14128 |
1/2✓ Branch 0 taken 102400 times.
✗ Branch 1 not taken.
|
102400 | if(!p_igetw(&(tempguy.s_tile),f)) |
| 14129 | { | ||
| 14130 | ✗ | return qe_invalid; | |
| 14131 | } | ||
| 14132 | } | ||
| 14133 | |||
| 14134 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_getc(&(tempguy.s_width),f)) |
| 14135 | { | ||
| 14136 | ✗ | return qe_invalid; | |
| 14137 | } | ||
| 14138 | |||
| 14139 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_getc(&(tempguy.s_height),f)) |
| 14140 | { | ||
| 14141 | ✗ | return qe_invalid; | |
| 14142 | } | ||
| 14143 | |||
| 14144 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
|
212480 | if ( guyversion >= 36 ) //expanded tiles |
| 14145 | { | ||
| 14146 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.e_tile),f)) |
| 14147 | { | ||
| 14148 | ✗ | return qe_invalid; | |
| 14149 | } | ||
| 14150 | 110080 | } | |
| 14151 | else | ||
| 14152 | { | ||
| 14153 |
1/2✓ Branch 0 taken 102400 times.
✗ Branch 1 not taken.
|
102400 | if(!p_igetw(&(tempguy.e_tile),f)) |
| 14154 | { | ||
| 14155 | ✗ | return qe_invalid; | |
| 14156 | } | ||
| 14157 | } | ||
| 14158 | |||
| 14159 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_getc(&(tempguy.e_width),f)) |
| 14160 | { | ||
| 14161 | ✗ | return qe_invalid; | |
| 14162 | } | ||
| 14163 | |||
| 14164 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_getc(&(tempguy.e_height),f)) |
| 14165 | { | ||
| 14166 | ✗ | return qe_invalid; | |
| 14167 | } | ||
| 14168 | |||
| 14169 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetw(&(tempguy.hp),f)) |
| 14170 | { | ||
| 14171 | ✗ | return qe_invalid; | |
| 14172 | } | ||
| 14173 | |||
| 14174 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetw(&(tempguy.type),f)) |
| 14175 | { | ||
| 14176 | ✗ | return qe_invalid; | |
| 14177 | } | ||
| 14178 | |||
| 14179 |
1/12✗ Branch 0 not taken.
✓ Branch 1 taken 212480 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
212480 | if(guyversion < 9 && (i==eDKNUT1 || i==eDKNUT2 || i==eDKNUT3 || i==eDKNUT4 || i==eDKNUT5)) // Whoops, forgot about Darknuts... |
| 14180 | { | ||
| 14181 | ✗ | if(get_qr(qr_NEWENEMYTILES)) | |
| 14182 | { | ||
| 14183 | ✗ | tempguy.s_tile=tempguy.e_tile+120; | |
| 14184 | ✗ | tempguy.s_width=tempguy.e_width; | |
| 14185 | ✗ | tempguy.s_height=tempguy.e_height; | |
| 14186 | ✗ | } | |
| 14187 | ✗ | else tempguy.s_tile=860; | |
| 14188 | ✗ | } | |
| 14189 | |||
| 14190 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetw(&(tempguy.cset),f)) |
| 14191 | { | ||
| 14192 | ✗ | return qe_invalid; | |
| 14193 | } | ||
| 14194 | |||
| 14195 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetw(&(tempguy.anim),f)) |
| 14196 | { | ||
| 14197 | ✗ | return qe_invalid; | |
| 14198 | } | ||
| 14199 | |||
| 14200 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetw(&(tempguy.e_anim),f)) |
| 14201 | { | ||
| 14202 | ✗ | return qe_invalid; | |
| 14203 | } | ||
| 14204 | |||
| 14205 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetw(&(tempguy.frate),f)) |
| 14206 | { | ||
| 14207 | ✗ | return qe_invalid; | |
| 14208 | } | ||
| 14209 | |||
| 14210 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetw(&(tempguy.e_frate),f)) |
| 14211 | { | ||
| 14212 | ✗ | return qe_invalid; | |
| 14213 | } | ||
| 14214 | |||
| 14215 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(guyversion < 13) // April 2009 |
| 14216 | { | ||
| 14217 | ✗ | if(get_bit(deprecated_rules, qr_SLOWENEMYANIM_DEP)) | |
| 14218 | { | ||
| 14219 | ✗ | tempguy.frate *= 2; | |
| 14220 | ✗ | tempguy.e_frate *= 2; | |
| 14221 | ✗ | } | |
| 14222 | ✗ | } | |
| 14223 | |||
| 14224 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(guyversion < 14) // May 1 2009 |
| 14225 | { | ||
| 14226 | ✗ | if(tempguy.anim==a2FRMSLOW) | |
| 14227 | { | ||
| 14228 | ✗ | tempguy.anim=a2FRM; | |
| 14229 | ✗ | tempguy.frate *= 2; | |
| 14230 | ✗ | } | |
| 14231 | |||
| 14232 | ✗ | if(tempguy.e_anim==a2FRMSLOW) | |
| 14233 | { | ||
| 14234 | ✗ | tempguy.e_anim=a2FRM; | |
| 14235 | ✗ | tempguy.e_frate *= 2; | |
| 14236 | ✗ | } | |
| 14237 | |||
| 14238 | ✗ | if(tempguy.anim==aFLIPSLOW) | |
| 14239 | { | ||
| 14240 | ✗ | tempguy.anim=aFLIP; | |
| 14241 | ✗ | tempguy.frate *= 2; | |
| 14242 | ✗ | } | |
| 14243 | |||
| 14244 | ✗ | if(tempguy.e_anim==aFLIPSLOW) | |
| 14245 | { | ||
| 14246 | ✗ | tempguy.e_anim=aFLIP; | |
| 14247 | ✗ | tempguy.e_frate *= 2; | |
| 14248 | ✗ | } | |
| 14249 | |||
| 14250 | ✗ | if(tempguy.anim == aNEWDWALK) tempguy.anim = a4FRM4DIR; | |
| 14251 | |||
| 14252 | ✗ | if(tempguy.e_anim == aNEWDWALK) tempguy.e_anim = a4FRM4DIR; | |
| 14253 | |||
| 14254 | ✗ | if(tempguy.anim == aNEWPOLV || tempguy.anim == a4FRM3TRAP) | |
| 14255 | { | ||
| 14256 | ✗ | tempguy.anim=a4FRM4DIR; | |
| 14257 | ✗ | tempguy.s_tile=(get_qr(qr_NEWENEMYTILES) ? tempguy.e_tile : tempguy.tile)+20; | |
| 14258 | ✗ | } | |
| 14259 | |||
| 14260 | ✗ | if(tempguy.e_anim == aNEWPOLV || tempguy.e_anim == a4FRM3TRAP) | |
| 14261 | { | ||
| 14262 | ✗ | tempguy.e_anim=a4FRM4DIR; | |
| 14263 | ✗ | tempguy.s_tile=(get_qr(qr_NEWENEMYTILES) ? tempguy.e_tile : tempguy.tile)+20; | |
| 14264 | ✗ | } | |
| 14265 | ✗ | } | |
| 14266 | |||
| 14267 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetw(&(tempguy.dp),f)) |
| 14268 | { | ||
| 14269 | ✗ | return qe_invalid; | |
| 14270 | } | ||
| 14271 | |||
| 14272 | //correction for guy fire | ||
| 14273 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(guyversion < 6) |
| 14274 | { | ||
| 14275 | ✗ | if(i == gFIRE) | |
| 14276 | ✗ | tempguy.dp = 2; | |
| 14277 | ✗ | } | |
| 14278 | |||
| 14279 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetw(&(tempguy.wdp),f)) |
| 14280 | { | ||
| 14281 | ✗ | return qe_invalid; | |
| 14282 | } | ||
| 14283 | |||
| 14284 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetw(&(tempguy.weapon),f)) |
| 14285 | { | ||
| 14286 | ✗ | return qe_invalid; | |
| 14287 | } | ||
| 14288 | |||
| 14289 | //correction for bosses using triple, "rising" fireballs | ||
| 14290 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(guyversion < 5) |
| 14291 | { | ||
| 14292 | ✗ | if(i == eLAQUAM || i == eRAQUAM || i == eGOHMA1 || i == eGOHMA2 || | |
| 14293 | ✗ | i == eGOHMA3 || i == eGOHMA4) | |
| 14294 | { | ||
| 14295 | ✗ | if(tempguy.weapon == ewFireball) | |
| 14296 | ✗ | tempguy.weapon = ewFireball2; | |
| 14297 | ✗ | } | |
| 14298 | ✗ | } | |
| 14299 | |||
| 14300 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetw(&(tempguy.rate),f)) |
| 14301 | { | ||
| 14302 | ✗ | return qe_invalid; | |
| 14303 | } | ||
| 14304 | |||
| 14305 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetw(&(tempguy.hrate),f)) |
| 14306 | { | ||
| 14307 | ✗ | return qe_invalid; | |
| 14308 | } | ||
| 14309 | |||
| 14310 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetw(&(tempguy.step),f)) |
| 14311 | { | ||
| 14312 | ✗ | return qe_invalid; | |
| 14313 | } | ||
| 14314 | |||
| 14315 | // HIGHLY UNORTHODOX UPDATING THING, part 2 | ||
| 14316 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 212480 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
212480 | if(fixpolsvoice && tempguy.type==eePOLSV) |
| 14317 | { | ||
| 14318 | ✗ | tempguy.step /= 2; | |
| 14319 | ✗ | } | |
| 14320 | |||
| 14321 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetw(&(tempguy.homing),f)) |
| 14322 | { | ||
| 14323 | ✗ | return qe_invalid; | |
| 14324 | } | ||
| 14325 | |||
| 14326 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetw(&(tempguy.grumble),f)) |
| 14327 | { | ||
| 14328 | ✗ | return qe_invalid; | |
| 14329 | } | ||
| 14330 | |||
| 14331 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetw(&(tempguy.item_set),f)) |
| 14332 | { | ||
| 14333 | ✗ | return qe_invalid; | |
| 14334 | } | ||
| 14335 | |||
| 14336 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(guyversion>=22) // Version 22: Expand misc attributes to 32 bits |
| 14337 | { | ||
| 14338 |
2/2✓ Branch 0 taken 2124800 times.
✓ Branch 1 taken 212480 times.
|
2337280 | for (int q = 0; q < 10; ++q) |
| 14339 | { | ||
| 14340 |
1/2✓ Branch 0 taken 2124800 times.
✗ Branch 1 not taken.
|
2124800 | if (!p_igetl(&(tempguy.attributes[q]), f)) |
| 14341 | { | ||
| 14342 | ✗ | return qe_invalid; | |
| 14343 | } | ||
| 14344 | 2124800 | } | |
| 14345 | 212480 | } | |
| 14346 | else | ||
| 14347 | { | ||
| 14348 | int16_t tempMisc; | ||
| 14349 | |||
| 14350 | ✗ | for(int q=0;q<10;q++) | |
| 14351 | { | ||
| 14352 | ✗ | if (!p_igetw(&tempMisc, f)) | |
| 14353 | { | ||
| 14354 | ✗ | return qe_invalid; | |
| 14355 | } | ||
| 14356 | ✗ | tempguy.attributes[q] = tempMisc; | |
| 14357 | ✗ | } | |
| 14358 | |||
| 14359 | ✗ | if(guyversion < 13) // April 2009 - a tiny Wizzrobe update | |
| 14360 | { | ||
| 14361 | ✗ | if(tempguy.type == eeWIZZ && !(tempguy.attributes[0])) | |
| 14362 | ✗ | tempguy.attributes[4] = 74; | |
| 14363 | ✗ | } | |
| 14364 | |||
| 14365 | } | ||
| 14366 | |||
| 14367 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetw(&(tempguy.bgsfx),f)) |
| 14368 | { | ||
| 14369 | ✗ | return qe_invalid; | |
| 14370 | } | ||
| 14371 | |||
| 14372 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetw(&(tempguy.bosspal),f)) |
| 14373 | { | ||
| 14374 | ✗ | return qe_invalid; | |
| 14375 | } | ||
| 14376 | |||
| 14377 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetw(&(tempguy.extend),f)) |
| 14378 | { | ||
| 14379 | ✗ | return qe_invalid; | |
| 14380 | } | ||
| 14381 | |||
| 14382 | //! Enemy Defences | ||
| 14383 | |||
| 14384 | //If a 2.50 quest, use only the 2.5 defences. | ||
| 14385 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 212480 times.
|
212480 | if(guyversion >= 16 ) // November 2009 - Super Enemy Editor |
| 14386 | { | ||
| 14387 |
2/2✓ Branch 0 taken 4037120 times.
✓ Branch 1 taken 212480 times.
|
4249600 | for(int32_t j=0; j<edefLAST; j++) |
| 14388 | { | ||
| 14389 |
1/2✓ Branch 0 taken 4037120 times.
✗ Branch 1 not taken.
|
4037120 | if(!p_getc(&(tempguy.defense[j]),f)) |
| 14390 | { | ||
| 14391 | ✗ | return qe_invalid; | |
| 14392 | } | ||
| 14393 | 4037120 | } | |
| 14394 | //then copy the generic script defence to all the new script defences | ||
| 14395 | |||
| 14396 | 212480 | } | |
| 14397 | |||
| 14398 | |||
| 14399 | |||
| 14400 | |||
| 14401 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 212480 times.
|
212480 | if(guyversion >= 18) |
| 14402 | { | ||
| 14403 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_getc(&(tempguy.hitsfx),f)) |
| 14404 | { | ||
| 14405 | ✗ | return qe_invalid; | |
| 14406 | } | ||
| 14407 | |||
| 14408 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_getc(&(tempguy.deadsfx),f)) |
| 14409 | { | ||
| 14410 | ✗ | return qe_invalid; | |
| 14411 | } | ||
| 14412 | 212480 | } | |
| 14413 | |||
| 14414 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(guyversion >= 22) |
| 14415 | { | ||
| 14416 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetl(&(tempguy.attributes[10]), f)) |
| 14417 | { | ||
| 14418 | ✗ | return qe_invalid; | |
| 14419 | } | ||
| 14420 | |||
| 14421 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(!p_igetl(&(tempguy.attributes[11]),f)) |
| 14422 | { | ||
| 14423 | ✗ | return qe_invalid; | |
| 14424 | } | ||
| 14425 | 212480 | } | |
| 14426 | ✗ | else if(guyversion >= 19) | |
| 14427 | { | ||
| 14428 | int16_t tempMisc; | ||
| 14429 | |||
| 14430 | ✗ | if(!p_igetw(&tempMisc,f)) | |
| 14431 | { | ||
| 14432 | ✗ | return qe_invalid; | |
| 14433 | } | ||
| 14434 | |||
| 14435 | ✗ | tempguy.attributes[10] = tempMisc; | |
| 14436 | |||
| 14437 | ✗ | if(!p_igetw(&tempMisc,f)) | |
| 14438 | { | ||
| 14439 | ✗ | return qe_invalid; | |
| 14440 | } | ||
| 14441 | |||
| 14442 | ✗ | tempguy.attributes[11] = tempMisc; | |
| 14443 | ✗ | } | |
| 14444 | |||
| 14445 | //If a 2.54 or later quest, use all of the defences. | ||
| 14446 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 110080 times.
|
212480 | if(guyversion > 24) // Add new guyversion conditional statement |
| 14447 | { | ||
| 14448 |
2/2✓ Branch 0 taken 2421760 times.
✓ Branch 1 taken 110080 times.
|
2531840 | for(int32_t j=edefLAST; j<edefLAST255; j++) |
| 14449 | { | ||
| 14450 |
1/2✓ Branch 0 taken 2421760 times.
✗ Branch 1 not taken.
|
2421760 | if(!p_getc(&(tempguy.defense[j]),f)) |
| 14451 | { | ||
| 14452 | ✗ | return qe_invalid; | |
| 14453 | } | ||
| 14454 | 2421760 | } | |
| 14455 | 110080 | } | |
| 14456 | |||
| 14457 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
|
212480 | if(guyversion <= 24) // Port over generic script settings from old quests in the new editor. |
| 14458 | { | ||
| 14459 |
2/2✓ Branch 0 taken 1024000 times.
✓ Branch 1 taken 102400 times.
|
1126400 | for(int32_t j=edefSCRIPT01; j<=edefSCRIPT10; j++) |
| 14460 | { | ||
| 14461 | 1024000 | tempguy.defense[j] = tempguy.defense[edefSCRIPT] ; | |
| 14462 | 1024000 | } | |
| 14463 | 102400 | } | |
| 14464 | |||
| 14465 | //tilewidth, tileheight, hitwidth, hitheight, hitzheight, hitxofs, hityofs, hitzofs | ||
| 14466 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 110080 times.
|
212480 | if(guyversion > 25) |
| 14467 | { | ||
| 14468 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.txsz),f)) |
| 14469 | { | ||
| 14470 | ✗ | return qe_invalid; | |
| 14471 | } | ||
| 14472 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.tysz),f)) |
| 14473 | { | ||
| 14474 | ✗ | return qe_invalid; | |
| 14475 | } | ||
| 14476 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.hxsz),f)) |
| 14477 | { | ||
| 14478 | ✗ | return qe_invalid; | |
| 14479 | } | ||
| 14480 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.hysz),f)) |
| 14481 | { | ||
| 14482 | ✗ | return qe_invalid; | |
| 14483 | } | ||
| 14484 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.hzsz),f)) |
| 14485 | { | ||
| 14486 | ✗ | return qe_invalid; | |
| 14487 | } | ||
| 14488 | /* Is it safe to read a fixed with getl, or do I need to typecast it? -Z | ||
| 14489 | |||
| 14490 | */ | ||
| 14491 | 110080 | } | |
| 14492 | //More Enemy Editor vars for 2.60 | ||
| 14493 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 110080 times.
|
212480 | if(guyversion > 26) |
| 14494 | { | ||
| 14495 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.hxofs),f)) |
| 14496 | { | ||
| 14497 | ✗ | return qe_invalid; | |
| 14498 | } | ||
| 14499 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.hyofs),f)) |
| 14500 | { | ||
| 14501 | ✗ | return qe_invalid; | |
| 14502 | } | ||
| 14503 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.xofs),f)) |
| 14504 | { | ||
| 14505 | ✗ | return qe_invalid; | |
| 14506 | } | ||
| 14507 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.yofs),f)) |
| 14508 | { | ||
| 14509 | ✗ | return qe_invalid; | |
| 14510 | } | ||
| 14511 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.zofs),f)) |
| 14512 | { | ||
| 14513 | ✗ | return qe_invalid; | |
| 14514 | } | ||
| 14515 | 110080 | } | |
| 14516 | |||
| 14517 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
|
212480 | if(guyversion <= 27) // Port over generic script settings from old quests in the new editor. |
| 14518 | { | ||
| 14519 | 102400 | tempguy.wpnsprite = 0; | |
| 14520 | 102400 | } | |
| 14521 | |||
| 14522 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 110080 times.
|
212480 | if(guyversion > 27) |
| 14523 | { | ||
| 14524 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.wpnsprite),f)) |
| 14525 | { | ||
| 14526 | ✗ | return qe_invalid; | |
| 14527 | } | ||
| 14528 | 110080 | } | |
| 14529 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
|
212480 | if(guyversion <= 28) // Port over generic script settings from old quests in the new editor. |
| 14530 | { | ||
| 14531 | 102400 | tempguy.SIZEflags = 0; | |
| 14532 | 102400 | } | |
| 14533 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 110080 times.
|
212480 | if(guyversion > 28) |
| 14534 | { | ||
| 14535 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.SIZEflags),f)) |
| 14536 | { | ||
| 14537 | ✗ | return qe_invalid; | |
| 14538 | } | ||
| 14539 | |||
| 14540 | 110080 | } | |
| 14541 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
|
212480 | if(guyversion < 30) // Port over generic script settings from old quests in the new editor. |
| 14542 | { | ||
| 14543 | 102400 | tempguy.frozentile = 0; | |
| 14544 | 102400 | tempguy.frozencset = 0; | |
| 14545 | 102400 | tempguy.frozenclock = 0; | |
| 14546 |
2/2✓ Branch 0 taken 1024000 times.
✓ Branch 1 taken 102400 times.
|
1126400 | for ( int32_t q = 0; q < 10; q++ ) tempguy.frozenmisc[q] = 0; |
| 14547 | 102400 | } | |
| 14548 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 110080 times.
|
212480 | if(guyversion >= 30) |
| 14549 | { | ||
| 14550 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.frozentile),f)) |
| 14551 | { | ||
| 14552 | ✗ | return qe_invalid; | |
| 14553 | } | ||
| 14554 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.frozencset),f)) |
| 14555 | { | ||
| 14556 | ✗ | return qe_invalid; | |
| 14557 | } | ||
| 14558 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.frozenclock),f)) |
| 14559 | { | ||
| 14560 | ✗ | return qe_invalid; | |
| 14561 | } | ||
| 14562 |
2/2✓ Branch 0 taken 1100800 times.
✓ Branch 1 taken 110080 times.
|
1210880 | for ( int32_t q = 0; q < 10; q++ ) { |
| 14563 |
1/2✓ Branch 0 taken 1100800 times.
✗ Branch 1 not taken.
|
1100800 | if(!p_igetw(&(tempguy.frozenmisc[q]),f)) |
| 14564 | { | ||
| 14565 | ✗ | return qe_invalid; | |
| 14566 | } | ||
| 14567 | 1100800 | } | |
| 14568 | |||
| 14569 | 110080 | } | |
| 14570 | |||
| 14571 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 110080 times.
|
212480 | if(guyversion >= 34) |
| 14572 | { | ||
| 14573 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetw(&(tempguy.firesfx),f)) |
| 14574 | { | ||
| 14575 | ✗ | return qe_invalid; | |
| 14576 | } | ||
| 14577 |
2/2✓ Branch 0 taken 1871360 times.
✓ Branch 1 taken 110080 times.
|
1981440 | for(int q=15;q<32;++q) |
| 14578 | { | ||
| 14579 |
1/2✓ Branch 0 taken 1871360 times.
✗ Branch 1 not taken.
|
1871360 | if(!p_igetl(&(tempguy.attributes[q]),f)) |
| 14580 | { | ||
| 14581 | ✗ | return qe_invalid; | |
| 14582 | } | ||
| 14583 | 1871360 | } | |
| 14584 | |||
| 14585 |
2/2✓ Branch 0 taken 3522560 times.
✓ Branch 1 taken 110080 times.
|
3632640 | for ( int32_t q = 0; q < 32; q++ ) { |
| 14586 |
1/2✓ Branch 0 taken 3522560 times.
✗ Branch 1 not taken.
|
3522560 | if(!p_igetl(&(tempguy.movement[q]),f)) |
| 14587 | { | ||
| 14588 | ✗ | return qe_invalid; | |
| 14589 | } | ||
| 14590 | 3522560 | } | |
| 14591 |
2/2✓ Branch 0 taken 3522560 times.
✓ Branch 1 taken 110080 times.
|
3632640 | for ( int32_t q = 0; q < 32; q++ ) { |
| 14592 |
1/2✓ Branch 0 taken 3522560 times.
✗ Branch 1 not taken.
|
3522560 | if(!p_igetl(&(tempguy.new_weapon[q]),f)) |
| 14593 | { | ||
| 14594 | ✗ | return qe_invalid; | |
| 14595 | } | ||
| 14596 | 3522560 | } | |
| 14597 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetw(&(tempguy.script),f)) |
| 14598 | { | ||
| 14599 | ✗ | return qe_invalid; | |
| 14600 | } | ||
| 14601 |
2/2✓ Branch 0 taken 880640 times.
✓ Branch 1 taken 110080 times.
|
990720 | for ( int32_t q = 0; q < 8; q++ ) |
| 14602 | { | ||
| 14603 |
1/2✓ Branch 0 taken 880640 times.
✗ Branch 1 not taken.
|
880640 | if(!p_igetl(&(tempguy.initD[q]),f)) |
| 14604 | { | ||
| 14605 | ✗ | return qe_invalid; | |
| 14606 | } | ||
| 14607 | 880640 | } | |
| 14608 |
2/2✓ Branch 0 taken 220160 times.
✓ Branch 1 taken 110080 times.
|
330240 | for ( int32_t q = 0; q < 2; q++ ) |
| 14609 | { | ||
| 14610 | int32_t temp; | ||
| 14611 |
1/2✓ Branch 0 taken 220160 times.
✗ Branch 1 not taken.
|
220160 | if(!p_igetl(&temp,f)) |
| 14612 | { | ||
| 14613 | ✗ | return qe_invalid; | |
| 14614 | } | ||
| 14615 | 220160 | } | |
| 14616 | |||
| 14617 | 110080 | } | |
| 14618 | |||
| 14619 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 110080 times.
|
212480 | if(guyversion >= 37) |
| 14620 | { | ||
| 14621 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.editorflags),f)) |
| 14622 | { | ||
| 14623 | ✗ | return qe_invalid; | |
| 14624 | } | ||
| 14625 | 110080 | } | |
| 14626 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
|
212480 | if ( guyversion < 37 ) { tempguy.editorflags = 0; } |
| 14627 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 110080 times.
|
212480 | if(guyversion >= 38) |
| 14628 | { | ||
| 14629 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.attributes[12]),f)) |
| 14630 | { | ||
| 14631 | ✗ | return qe_invalid; | |
| 14632 | } | ||
| 14633 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.attributes[13]),f)) |
| 14634 | { | ||
| 14635 | ✗ | return qe_invalid; | |
| 14636 | } | ||
| 14637 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_igetl(&(tempguy.attributes[14]),f)) |
| 14638 | { | ||
| 14639 | ✗ | return qe_invalid; | |
| 14640 | } | ||
| 14641 | |||
| 14642 | 110080 | } | |
| 14643 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
|
212480 | if ( guyversion < 38 ) |
| 14644 | { | ||
| 14645 | 102400 | tempguy.attributes[12] = 0; | |
| 14646 | 102400 | tempguy.attributes[13] = 0; | |
| 14647 | 102400 | tempguy.attributes[14] = 0; | |
| 14648 | 102400 | } | |
| 14649 | |||
| 14650 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 110080 times.
|
212480 | if ( guyversion >= 39 ) |
| 14651 | { | ||
| 14652 |
2/2✓ Branch 0 taken 880640 times.
✓ Branch 1 taken 110080 times.
|
990720 | for ( int32_t q = 0; q < 8; q++ ) |
| 14653 | { | ||
| 14654 |
2/2✓ Branch 0 taken 57241600 times.
✓ Branch 1 taken 880640 times.
|
58122240 | for ( int32_t w = 0; w < 65; w++ ) |
| 14655 | { | ||
| 14656 |
1/2✓ Branch 0 taken 57241600 times.
✗ Branch 1 not taken.
|
57241600 | if(!p_getc(&(tempguy.initD_label[q][w]),f)) |
| 14657 | { | ||
| 14658 | ✗ | return qe_invalid; | |
| 14659 | } | ||
| 14660 | 57241600 | } | |
| 14661 |
2/2✓ Branch 0 taken 667648 times.
✓ Branch 1 taken 212992 times.
|
880640 | if(guyversion < 54) |
| 14662 | { | ||
| 14663 | byte dummybyte; | ||
| 14664 |
2/2✓ Branch 0 taken 13844480 times.
✓ Branch 1 taken 212992 times.
|
14057472 | for ( int32_t w = 0; w < 65; w++ ) |
| 14665 |
1/2✓ Branch 0 taken 13844480 times.
✗ Branch 1 not taken.
|
13844480 | if(!p_getc(&dummybyte,f)) |
| 14666 | ✗ | return qe_invalid; | |
| 14667 | 212992 | } | |
| 14668 | 880640 | } | |
| 14669 | |||
| 14670 | |||
| 14671 | 110080 | } | |
| 14672 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
|
212480 | if ( guyversion < 39 ) //apply old InitD strings to both |
| 14673 | { | ||
| 14674 |
2/2✓ Branch 0 taken 819200 times.
✓ Branch 1 taken 102400 times.
|
921600 | for ( int32_t q = 0; q < 8; q++ ) |
| 14675 | { | ||
| 14676 | 819200 | sprintf(tempguy.initD_label[q],"InitD[%d]",q); | |
| 14677 | 819200 | } | |
| 14678 | 102400 | } | |
| 14679 |
4/4✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
✓ Branch 2 taken 83456 times.
✓ Branch 3 taken 26624 times.
|
212480 | if ( guyversion >= 40 && guyversion < 54) |
| 14680 |
1/2✓ Branch 0 taken 26624 times.
✗ Branch 1 not taken.
|
26624 | if(!p_igetw(&(tempguy.weap_data.script),f)) |
| 14681 | ✗ | return qe_invalid; | |
| 14682 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
|
212480 | if ( guyversion < 40 ) |
| 14683 | 102400 | tempguy.weap_data.script = 0; | |
| 14684 | //eweapon script InitD | ||
| 14685 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 110080 times.
|
212480 | if ( guyversion >= 41 ) |
| 14686 | { | ||
| 14687 |
2/2✓ Branch 0 taken 83456 times.
✓ Branch 1 taken 26624 times.
|
110080 | if(guyversion < 54) |
| 14688 |
2/2✓ Branch 0 taken 212992 times.
✓ Branch 1 taken 26624 times.
|
239616 | for ( int32_t q = 0; q < 8; q++ ) |
| 14689 |
1/2✓ Branch 0 taken 212992 times.
✗ Branch 1 not taken.
|
212992 | if(!p_igetl(&(tempguy.weap_data.initd[q]),f)) |
| 14690 | 26624 | return qe_invalid; | |
| 14691 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if ( guy_cversion < 4 ) |
| 14692 | { | ||
| 14693 | ✗ | if ( tempguy.type == eeKEESE ) | |
| 14694 | { | ||
| 14695 | |||
| 14696 | ✗ | if ( !tempguy.attributes[0] ) | |
| 14697 | { | ||
| 14698 | ✗ | tempguy.attributes[15] = 120; | |
| 14699 | ✗ | tempguy.attributes[16] = 16; | |
| 14700 | |||
| 14701 | ✗ | } | |
| 14702 | ✗ | } | |
| 14703 | ✗ | if ( tempguy.type == eePEAHAT ) | |
| 14704 | { | ||
| 14705 | ✗ | tempguy.attributes[15] = 80; | |
| 14706 | ✗ | tempguy.attributes[16] = 16; | |
| 14707 | ✗ | } | |
| 14708 | |||
| 14709 | ✗ | if ( tempguy.type == eeGHINI ) | |
| 14710 | { | ||
| 14711 | ✗ | tempguy.attributes[15] = 120; | |
| 14712 | ✗ | tempguy.attributes[16] = 10; | |
| 14713 | ✗ | } | |
| 14714 | |||
| 14715 | ✗ | } | |
| 14716 | 110080 | } | |
| 14717 | |||
| 14718 | |||
| 14719 | |||
| 14720 | //default weapon sprites (quest version < 2.54) | ||
| 14721 | //port over old defaults -Z | ||
| 14722 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
|
212480 | if(guyversion < 32) |
| 14723 | { | ||
| 14724 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 102400 times.
|
102400 | if ( tempguy.wpnsprite <= 0 ) |
| 14725 | { | ||
| 14726 |
16/20✗ Branch 0 not taken.
✓ Branch 1 taken 2849 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 86878 times.
✓ Branch 4 taken 801 times.
✓ Branch 5 taken 691 times.
✓ Branch 6 taken 1900 times.
✓ Branch 7 taken 1291 times.
✓ Branch 8 taken 2399 times.
✓ Branch 9 taken 206 times.
✓ Branch 10 taken 77 times.
✓ Branch 11 taken 448 times.
✓ Branch 12 taken 79 times.
✓ Branch 13 taken 906 times.
✓ Branch 14 taken 1802 times.
✓ Branch 15 taken 229 times.
✓ Branch 16 taken 325 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1519 times.
|
102400 | switch(tempguy.weapon) |
| 14727 | { | ||
| 14728 | case wNone: | ||
| 14729 | 86878 | tempguy.wpnsprite = 0; break; | |
| 14730 | |||
| 14731 | case wSword: | ||
| 14732 | case wBeam: | ||
| 14733 | case wBrang: | ||
| 14734 | case wBomb: | ||
| 14735 | case wSBomb: | ||
| 14736 | case wLitBomb: | ||
| 14737 | case wLitSBomb: | ||
| 14738 | case wArrow: | ||
| 14739 | case wFire: | ||
| 14740 | case wWhistle: | ||
| 14741 | case wBait: | ||
| 14742 | case wWand: | ||
| 14743 | case wMagic: | ||
| 14744 | case wCatching: | ||
| 14745 | case wWind: | ||
| 14746 | case wRefMagic: | ||
| 14747 | case wRefFireball: | ||
| 14748 | case wRefRock: | ||
| 14749 | case wHammer: | ||
| 14750 | case wHookshot: | ||
| 14751 | case wHSHandle: | ||
| 14752 | case wHSChain: | ||
| 14753 | case wSSparkle: | ||
| 14754 | case wFSparkle: | ||
| 14755 | case wSmack: | ||
| 14756 | case wPhantom: | ||
| 14757 | case wCByrna: | ||
| 14758 | case wRefBeam: | ||
| 14759 | case wStomp: | ||
| 14760 | case lwMax: | ||
| 14761 | case wScript1: | ||
| 14762 | case wScript2: | ||
| 14763 | case wScript3: | ||
| 14764 | case wScript4: | ||
| 14765 | case wScript5: | ||
| 14766 | case wScript6: | ||
| 14767 | case wScript7: | ||
| 14768 | case wScript8: | ||
| 14769 | case wScript9: | ||
| 14770 | case wScript10: | ||
| 14771 | case wIce: | ||
| 14772 | //Cannot use any of these weapons yet. | ||
| 14773 | ✗ | tempguy.wpnsprite = -1; | |
| 14774 | ✗ | break; | |
| 14775 | |||
| 14776 | case wEnemyWeapons: | ||
| 14777 | 2849 | case ewFireball: tempguy.wpnsprite = 17; break; | |
| 14778 | |||
| 14779 | 801 | case ewArrow: tempguy.wpnsprite = 19; break; | |
| 14780 | 691 | case ewBrang: tempguy.wpnsprite = 4; break; | |
| 14781 | 1900 | case ewSword: tempguy.wpnsprite = 20; break; | |
| 14782 | 1291 | case ewRock: tempguy.wpnsprite = 18; break; | |
| 14783 | 2399 | case ewMagic: tempguy.wpnsprite = 21; break; | |
| 14784 | 206 | case ewBomb: tempguy.wpnsprite = 78; break; | |
| 14785 | 77 | case ewSBomb: tempguy.wpnsprite = 79; break; | |
| 14786 | 448 | case ewLitBomb: tempguy.wpnsprite = 76; break; | |
| 14787 | 79 | case ewLitSBomb: tempguy.wpnsprite = 77; break; | |
| 14788 | 906 | case ewFireTrail: tempguy.wpnsprite = 80; break; | |
| 14789 | 1802 | case ewFlame: tempguy.wpnsprite = 35; break; | |
| 14790 | 229 | case ewWind: tempguy.wpnsprite = 36; break; | |
| 14791 | 325 | case ewFlame2: tempguy.wpnsprite = 81; break; | |
| 14792 | ✗ | case ewFlame2Trail: tempguy.wpnsprite = 82; break; | |
| 14793 | ✗ | case ewIce: tempguy.wpnsprite = 83; break; | |
| 14794 | 1519 | case ewFireball2: tempguy.wpnsprite = 17; break; //fireball (rising) | |
| 14795 | |||
| 14796 | |||
| 14797 | ✗ | default: break; //No assign. | |
| 14798 | } | ||
| 14799 | 102400 | } | |
| 14800 | 102400 | } | |
| 14801 | |||
| 14802 | //default weapon fire sound (quest version < 2.54) | ||
| 14803 | //port over old defaults and zero new data. -Z | ||
| 14804 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
|
212480 | if(guyversion < 34) |
| 14805 | { | ||
| 14806 |
2/2✓ Branch 0 taken 3276800 times.
✓ Branch 1 taken 102400 times.
|
3379200 | for ( int32_t q = 0; q < 32; q++ ) |
| 14807 | { | ||
| 14808 | 3276800 | tempguy.movement[q] = 0; | |
| 14809 | 3276800 | tempguy.new_weapon[q] = 0; | |
| 14810 | |||
| 14811 | 3276800 | } | |
| 14812 | |||
| 14813 | //NPC Script attributes. | ||
| 14814 | 102400 | tempguy.script = 0; //No scripted enemies existed. -Z | |
| 14815 |
2/2✓ Branch 0 taken 819200 times.
✓ Branch 1 taken 102400 times.
|
921600 | for ( int32_t q = 0; q < 8; q++ ) tempguy.initD[q] = 0; //Script Data |
| 14816 | |||
| 14817 |
2/2✓ Branch 0 taken 1740800 times.
✓ Branch 1 taken 102400 times.
|
1843200 | for ( int32_t q = 15; q < 32; q++) tempguy.attributes[q] = 0; //misc 16-32 |
| 14818 | |||
| 14819 | //old default sounds | ||
| 14820 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 102400 times.
|
102400 | if ( tempguy.firesfx <= 0 ) |
| 14821 | { | ||
| 14822 |
16/20✗ Branch 0 not taken.
✓ Branch 1 taken 2849 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 86878 times.
✓ Branch 4 taken 801 times.
✓ Branch 5 taken 691 times.
✓ Branch 6 taken 1900 times.
✓ Branch 7 taken 1291 times.
✓ Branch 8 taken 2399 times.
✓ Branch 9 taken 206 times.
✓ Branch 10 taken 77 times.
✓ Branch 11 taken 448 times.
✓ Branch 12 taken 79 times.
✓ Branch 13 taken 906 times.
✓ Branch 14 taken 1802 times.
✓ Branch 15 taken 229 times.
✓ Branch 16 taken 325 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1519 times.
|
102400 | switch(tempguy.weapon) |
| 14823 | { | ||
| 14824 | case wNone: | ||
| 14825 | 86878 | tempguy.firesfx = 0; break; | |
| 14826 | |||
| 14827 | case wSword: | ||
| 14828 | case wBeam: | ||
| 14829 | case wBrang: | ||
| 14830 | case wBomb: | ||
| 14831 | case wSBomb: | ||
| 14832 | case wLitBomb: | ||
| 14833 | case wLitSBomb: | ||
| 14834 | case wArrow: | ||
| 14835 | case wFire: | ||
| 14836 | case wWhistle: | ||
| 14837 | case wBait: | ||
| 14838 | case wWand: | ||
| 14839 | case wMagic: | ||
| 14840 | case wCatching: | ||
| 14841 | case wWind: | ||
| 14842 | case wRefMagic: | ||
| 14843 | case wRefFireball: | ||
| 14844 | case wRefRock: | ||
| 14845 | case wHammer: | ||
| 14846 | case wHookshot: | ||
| 14847 | case wHSHandle: | ||
| 14848 | case wHSChain: | ||
| 14849 | case wSSparkle: | ||
| 14850 | case wFSparkle: | ||
| 14851 | case wSmack: | ||
| 14852 | case wPhantom: | ||
| 14853 | case wCByrna: | ||
| 14854 | case wRefBeam: | ||
| 14855 | case wStomp: | ||
| 14856 | case lwMax: | ||
| 14857 | case wScript1: | ||
| 14858 | case wScript2: | ||
| 14859 | case wScript3: | ||
| 14860 | case wScript4: | ||
| 14861 | case wScript5: | ||
| 14862 | case wScript6: | ||
| 14863 | case wScript7: | ||
| 14864 | case wScript8: | ||
| 14865 | case wScript9: | ||
| 14866 | case wScript10: | ||
| 14867 | case wIce: | ||
| 14868 | //Cannot use any of these weapons yet. | ||
| 14869 | ✗ | tempguy.firesfx = -1; | |
| 14870 | ✗ | break; | |
| 14871 | |||
| 14872 | case wEnemyWeapons: | ||
| 14873 | 2849 | case ewFireball: tempguy.firesfx = 40; break; | |
| 14874 | |||
| 14875 | 801 | case ewArrow: tempguy.firesfx = 1; break; //Ghost.zh has 0? | |
| 14876 | 691 | case ewBrang: tempguy.firesfx = 4; break; //Ghost.zh has 0? | |
| 14877 | 1900 | case ewSword: tempguy.firesfx = 20; break; //Ghost.zh has 0? | |
| 14878 | 1291 | case ewRock: tempguy.firesfx = 51; break; | |
| 14879 | 2399 | case ewMagic: tempguy.firesfx = 32; break; | |
| 14880 | 206 | case ewBomb: tempguy.firesfx = 3; break; //Ghost.zh has 0? | |
| 14881 | 77 | case ewSBomb: tempguy.firesfx = 3; break; //Ghost.zh has 0? | |
| 14882 | 448 | case ewLitBomb: tempguy.firesfx = 21; break; //Ghost.zh has 0? | |
| 14883 | 79 | case ewLitSBomb: tempguy.firesfx = 21; break; //Ghost.zh has 0? | |
| 14884 | 906 | case ewFireTrail: tempguy.firesfx = 13; break; | |
| 14885 | 1802 | case ewFlame: tempguy.firesfx = 13; break; | |
| 14886 | 229 | case ewWind: tempguy.firesfx = 32; break; | |
| 14887 | 325 | case ewFlame2: tempguy.firesfx = 13; break; | |
| 14888 | ✗ | case ewFlame2Trail: tempguy.firesfx = 13; break; | |
| 14889 | ✗ | case ewIce: tempguy.firesfx = 44; break; | |
| 14890 | 1519 | case ewFireball2: tempguy.firesfx = 40; break; //fireball (rising) | |
| 14891 | |||
| 14892 | //what about special attacks (e.g. summoning == 56) | ||
| 14893 | ✗ | default: break; //No assign. | |
| 14894 | } | ||
| 14895 | 102400 | } | |
| 14896 | 102400 | } | |
| 14897 | |||
| 14898 | //Port hardcoded hit sound to the enemy hitsfx defaults for older quests. | ||
| 14899 |
4/6✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
✓ Branch 2 taken 110080 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 110080 times.
|
212480 | if(Header->zelda_version <= 0x250 || ( Header->zelda_version > 0x250 && guyversion < 35 )) |
| 14900 | { | ||
| 14901 |
2/2✓ Branch 0 taken 89799 times.
✓ Branch 1 taken 12601 times.
|
102400 | if ( tempguy.hitsfx == 0 ) tempguy.hitsfx = 11; |
| 14902 | 102400 | } | |
| 14903 | //Keese and bat halt rates. | ||
| 14904 |
3/4✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 110080 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 102400 times.
|
212480 | if ( guyversion < 42 && guy_cversion < 4 ) |
| 14905 | { | ||
| 14906 | |||
| 14907 |
2/2✓ Branch 0 taken 101101 times.
✓ Branch 1 taken 1299 times.
|
102400 | if ( tempguy.type == eeKEESE ) |
| 14908 | { | ||
| 14909 | |||
| 14910 |
2/2✓ Branch 0 taken 935 times.
✓ Branch 1 taken 364 times.
|
1299 | if ( !tempguy.attributes[0] ) |
| 14911 | { | ||
| 14912 | 935 | tempguy.attributes[15] = 120; | |
| 14913 | 935 | tempguy.attributes[16] = 16; | |
| 14914 | |||
| 14915 | 935 | } | |
| 14916 | 1299 | } | |
| 14917 |
2/2✓ Branch 0 taken 101935 times.
✓ Branch 1 taken 465 times.
|
102400 | if ( tempguy.type == eePEAHAT ) |
| 14918 | { | ||
| 14919 | 465 | tempguy.attributes[15] = 80; | |
| 14920 | 465 | tempguy.attributes[16] = 16; | |
| 14921 | 465 | } | |
| 14922 |
2/2✓ Branch 0 taken 102200 times.
✓ Branch 1 taken 200 times.
|
102400 | if ( tempguy.type == eeGHINI ) |
| 14923 | { | ||
| 14924 | 200 | tempguy.attributes[15] = 120; | |
| 14925 | 200 | tempguy.attributes[16] = 10; | |
| 14926 | 200 | } | |
| 14927 | |||
| 14928 | |||
| 14929 | 102400 | } | |
| 14930 | |||
| 14931 | |||
| 14932 | //miscellaneous other corrections | ||
| 14933 | //fix the mirror wizzrobe -DD | ||
| 14934 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(guyversion < 7) |
| 14935 | { | ||
| 14936 | ✗ | if(i == eMWIZ) | |
| 14937 | { | ||
| 14938 | ✗ | tempguy.attributes[1] = 0; | |
| 14939 | ✗ | tempguy.attributes[3] = 1; | |
| 14940 | ✗ | } | |
| 14941 | ✗ | } | |
| 14942 | |||
| 14943 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(guyversion < 8) |
| 14944 | { | ||
| 14945 | ✗ | if(i == eGLEEOK1 || i == eGLEEOK2 || i == eGLEEOK3 || i == eGLEEOK4 || i == eGLEEOK1F || i == eGLEEOK2F || i == eGLEEOK3F || i == eGLEEOK4F) | |
| 14946 | { | ||
| 14947 | // Some of these are deliberately different to NewDefault/defdata.cpp, by the way. -L | ||
| 14948 | ✗ | tempguy.attributes[4] = 4; //neck length in segments | |
| 14949 | ✗ | tempguy.attributes[5] = 8; //neck offset from first body tile | |
| 14950 | ✗ | tempguy.attributes[6] = 40; //offset for each subsequent neck tile from the first neck tile | |
| 14951 | ✗ | tempguy.attributes[7] = 168; //head offset from first body tile | |
| 14952 | ✗ | tempguy.attributes[8] = 228; //flying head offset from first body tile | |
| 14953 | |||
| 14954 | ✗ | if(i == eGLEEOK1F || i == eGLEEOK2F || i == eGLEEOK3F || i == eGLEEOK4F) | |
| 14955 | { | ||
| 14956 | ✗ | tempguy.attributes[5] += 10; //neck offset from first body tile | |
| 14957 | ✗ | tempguy.attributes[7] -= 12; //head offset from first body tile | |
| 14958 | ✗ | } | |
| 14959 | ✗ | } | |
| 14960 | ✗ | } | |
| 14961 | |||
| 14962 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(guyversion < 10) // December 2007 - Dodongo CSet fix |
| 14963 | { | ||
| 14964 | ✗ | if(get_bit(deprecated_rules,46) && tempguy.type==eeDONGO && tempguy.attributes[0]==0) | |
| 14965 | ✗ | tempguy.bosspal = spDIG; | |
| 14966 | ✗ | } | |
| 14967 | |||
| 14968 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(guyversion < 11) // December 2007 - Spinning Tile fix |
| 14969 | { | ||
| 14970 | ✗ | if(tempguy.type==eeSPINTILE) | |
| 14971 | { | ||
| 14972 | ✗ | tempguy.flags |= guy_superman; | |
| 14973 | ✗ | tempguy.item_set = 0; // Don't drop items | |
| 14974 | ✗ | tempguy.step = 300; | |
| 14975 | ✗ | } | |
| 14976 | ✗ | } | |
| 14977 | |||
| 14978 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(guyversion < 12) // October 2008 - Flashing Bubble, Rope 2, and Ghini 2 fix |
| 14979 | { | ||
| 14980 | ✗ | if(get_bit(deprecated_rules, qr_NOROPE2FLASH_DEP)) | |
| 14981 | { | ||
| 14982 | ✗ | if(tempguy.type==eeROPE) | |
| 14983 | { | ||
| 14984 | ✗ | tempguy.flags &= ~guy_flashing; | |
| 14985 | ✗ | } | |
| 14986 | ✗ | } | |
| 14987 | |||
| 14988 | ✗ | if(get_bit(deprecated_rules, qr_NOBUBBLEFLASH_DEP)) | |
| 14989 | { | ||
| 14990 | ✗ | if(tempguy.type==eeBUBBLE) | |
| 14991 | { | ||
| 14992 | ✗ | tempguy.flags &= ~guy_flashing; | |
| 14993 | ✗ | } | |
| 14994 | ✗ | } | |
| 14995 | |||
| 14996 | ✗ | if((tempguy.type==eeGHINI)&&(tempguy.attributes[0])) | |
| 14997 | { | ||
| 14998 | ✗ | if(get_bit(deprecated_rules, qr_GHINI2BLINK_DEP)) | |
| 14999 | { | ||
| 15000 | ✗ | tempguy.flags |= guy_blinking; | |
| 15001 | ✗ | } | |
| 15002 | |||
| 15003 | ✗ | if(get_bit(deprecated_rules, qr_PHANTOMGHINI2_DEP)) | |
| 15004 | { | ||
| 15005 | ✗ | tempguy.flags |= guy_transparent; | |
| 15006 | ✗ | } | |
| 15007 | ✗ | } | |
| 15008 | ✗ | } | |
| 15009 | |||
| 15010 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(guyversion < 15) // July 2009 - Guy Fire and Fairy fix |
| 15011 | { | ||
| 15012 | ✗ | if(i==gFIRE) | |
| 15013 | { | ||
| 15014 | ✗ | tempguy.e_anim = aFLIP; | |
| 15015 | ✗ | tempguy.e_frate = 24; | |
| 15016 | ✗ | } | |
| 15017 | |||
| 15018 | ✗ | if(i==gFAIRY) | |
| 15019 | { | ||
| 15020 | ✗ | tempguy.e_anim = a2FRM; | |
| 15021 | ✗ | tempguy.e_frate = 16; | |
| 15022 | ✗ | } | |
| 15023 | ✗ | } | |
| 15024 | |||
| 15025 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(guyversion < 16) // November 2009 - Super Enemy Editor part 1 |
| 15026 | { | ||
| 15027 | ✗ | if(i==0) Z_message("Updating guys to version 16...\n"); | |
| 15028 | |||
| 15029 | ✗ | update_guy_1(&tempguy); | |
| 15030 | |||
| 15031 | ✗ | if(i==eMPOLSV) | |
| 15032 | { | ||
| 15033 | ✗ | tempguy.defense[edefARROW] = edCHINK; | |
| 15034 | ✗ | tempguy.defense[edefMAGIC] = ed1HKO; | |
| 15035 | ✗ | tempguy.defense[edefREFMAGIC] = ed1HKO; | |
| 15036 | ✗ | } | |
| 15037 | ✗ | } | |
| 15038 | |||
| 15039 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(guyversion < 17) // December 2009 |
| 15040 | { | ||
| 15041 | ✗ | if(tempguy.type==eePROJECTILE) | |
| 15042 | { | ||
| 15043 | ✗ | tempguy.attributes[0] = 0; | |
| 15044 | ✗ | } | |
| 15045 | ✗ | } | |
| 15046 | |||
| 15047 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(guyversion < 18) // January 2010 |
| 15048 | { | ||
| 15049 | ✗ | bool boss = (tempguy.type == eeAQUA || tempguy.type==eeDONGO || tempguy.type == eeMANHAN || tempguy.type == eeGHOMA || tempguy.type==eeDIG | |
| 15050 | ✗ | || tempguy.type == eeGLEEOK || tempguy.type==eePATRA || tempguy.type == eeGANON || tempguy.type==eeMOLD); | |
| 15051 | |||
| 15052 | ✗ | tempguy.hitsfx = (boss && tempguy.type != eeMOLD && tempguy.type != eeDONGO && tempguy.type != eeDIG) ? WAV_GASP : 0; | |
| 15053 | ✗ | tempguy.deadsfx = (boss && (tempguy.type != eeDIG || tempguy.attributes[9] == 0)) ? WAV_GASP : WAV_EDEAD; | |
| 15054 | |||
| 15055 | ✗ | if(tempguy.type == eeAQUA) | |
| 15056 | ✗ | for(int32_t j=0; j<edefLAST; j++) tempguy.defense[j] = default_guys[eRAQUAM].defense[j]; | |
| 15057 | ✗ | else if(tempguy.type == eeMANHAN) | |
| 15058 | ✗ | for(int32_t j=0; j<edefLAST; j++) tempguy.defense[j] = default_guys[eMANHAN].defense[j]; | |
| 15059 | ✗ | else if(tempguy.type==eePATRA) | |
| 15060 | ✗ | for(int32_t j=0; j<edefLAST; j++) tempguy.defense[j] = default_guys[eGLEEOK1].defense[j]; | |
| 15061 | ✗ | else if(tempguy.type==eeGHOMA) | |
| 15062 | { | ||
| 15063 | ✗ | for(int32_t j=0; j<edefLAST; j++) | |
| 15064 | ✗ | tempguy.defense[j] = default_guys[eGOHMA1].defense[j]; | |
| 15065 | |||
| 15066 | ✗ | tempguy.defense[edefARROW] = ((tempguy.attributes[0]==3) ? edCHINKL8 : (tempguy.attributes[0]==2) ? edCHINKL4 : 0); | |
| 15067 | |||
| 15068 | ✗ | if(tempguy.attributes[0]==3 && !tempguy.weapon) tempguy.weapon = ewFlame; | |
| 15069 | |||
| 15070 | ✗ | tempguy.attributes[0]--; | |
| 15071 | ✗ | } | |
| 15072 | ✗ | else if(tempguy.type == eeGLEEOK) | |
| 15073 | { | ||
| 15074 | ✗ | for(int32_t j=0; j<edefLAST; j++) | |
| 15075 | ✗ | tempguy.defense[j] = default_guys[eGLEEOK1].defense[j]; | |
| 15076 | |||
| 15077 | ✗ | if(tempguy.attributes[2]==1 && !tempguy.weapon) tempguy.weapon = ewFlame; | |
| 15078 | ✗ | } | |
| 15079 | ✗ | else if(tempguy.type == eeARMOS) | |
| 15080 | { | ||
| 15081 | ✗ | tempguy.type=eeWALK; | |
| 15082 | ✗ | tempguy.hrate = 0; | |
| 15083 | ✗ | tempguy.attributes[9] = tempguy.attributes[0]; | |
| 15084 | ✗ | tempguy.attributes[0] = tempguy.attributes[1] = tempguy.attributes[2] = tempguy.attributes[3] = tempguy.attributes[4] = tempguy.attributes[5] = tempguy.attributes[6] = tempguy.attributes[7] = 0; | |
| 15085 | ✗ | tempguy.attributes[0] = tempguy.attributes[1] = tempguy.attributes[2] = tempguy.attributes[3] = tempguy.attributes[4] = tempguy.attributes[5] = tempguy.attributes[6] = tempguy.attributes[7] = 0; | |
| 15086 | ✗ | tempguy.attributes[8] = e9tARMOS; | |
| 15087 | ✗ | } | |
| 15088 | ✗ | else if(tempguy.type == eeGHINI && !tempguy.attributes[0]) | |
| 15089 | { | ||
| 15090 | ✗ | tempguy.type=eeWALK; | |
| 15091 | ✗ | tempguy.hrate = 0; | |
| 15092 | ✗ | tempguy.attributes[0] = tempguy.attributes[1] = tempguy.attributes[2] = tempguy.attributes[3] = tempguy.attributes[4] = tempguy.attributes[5] = | |
| 15093 | ✗ | tempguy.attributes[6] = tempguy.attributes[7] = tempguy.attributes[8] = tempguy.attributes[9] = 0; | |
| 15094 | ✗ | } | |
| 15095 | |||
| 15096 | // Spawn animation flags | ||
| 15097 | ✗ | if(tempguy.type == eeWALK && (tempguy.flags&guy_armos || tempguy.flags&guy_ghini)) | |
| 15098 | ✗ | tempguy.flags |= guy_fade_flicker; | |
| 15099 | else | ||
| 15100 | ✗ | tempguy.flags &= (guy_flags)0x0F00000F; // Get rid of the unused flags! | |
| 15101 | ✗ | } | |
| 15102 | |||
| 15103 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(guyversion < 20) // April 2010 |
| 15104 | { | ||
| 15105 | ✗ | if(tempguy.type == eeTRAP) | |
| 15106 | { | ||
| 15107 | ✗ | tempguy.attributes[1] = tempguy.attributes[9]; | |
| 15108 | |||
| 15109 | ✗ | if(tempguy.attributes[9]>=1) | |
| 15110 | { | ||
| 15111 | ✗ | tempguy.attributes[0]++; | |
| 15112 | ✗ | } | |
| 15113 | |||
| 15114 | ✗ | tempguy.attributes[9] = 0; | |
| 15115 | ✗ | } | |
| 15116 | |||
| 15117 | // Bomb Blast fix | ||
| 15118 | ✗ | if(tempguy.weapon==ewBomb && tempguy.type!=eeROPE && (tempguy.type!=eeWALK || tempguy.attributes[1] != e2tBOMBCHU)) | |
| 15119 | ✗ | tempguy.weapon = ewLitBomb; | |
| 15120 | ✗ | else if(tempguy.weapon==ewSBomb && tempguy.type!=eeROPE && (tempguy.type!=eeWALK || tempguy.attributes[1] != e2tBOMBCHU)) | |
| 15121 | ✗ | tempguy.weapon = ewLitSBomb; | |
| 15122 | ✗ | } | |
| 15123 | |||
| 15124 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(guyversion < 21) // September 2011 |
| 15125 | { | ||
| 15126 | ✗ | if(tempguy.type == eeKEESE || tempguy.type == eeKEESETRIB) | |
| 15127 | { | ||
| 15128 | ✗ | if(tempguy.type == eeKEESETRIB) | |
| 15129 | { | ||
| 15130 | ✗ | tempguy.type = eeKEESE; | |
| 15131 | ✗ | tempguy.attributes[1] = e2tKEESETRIB; | |
| 15132 | ✗ | tempguy.attributes[0] = 0; | |
| 15133 | ✗ | } | |
| 15134 | |||
| 15135 | ✗ | tempguy.rate = 2; | |
| 15136 | ✗ | tempguy.hrate = 8; | |
| 15137 | ✗ | tempguy.homing = 0; | |
| 15138 | ✗ | tempguy.step= (tempguy.type == eeKEESE && tempguy.attributes[0] ? 100:62); | |
| 15139 | ✗ | } | |
| 15140 | ✗ | else if(tempguy.type == eePEAHAT || tempguy.type==eePATRA) | |
| 15141 | { | ||
| 15142 | ✗ | if(tempguy.type == eePEAHAT) | |
| 15143 | { | ||
| 15144 | ✗ | tempguy.rate = 4; | |
| 15145 | ✗ | tempguy.step = 62; | |
| 15146 | ✗ | } | |
| 15147 | else | ||
| 15148 | ✗ | tempguy.step = 25; | |
| 15149 | |||
| 15150 | ✗ | tempguy.hrate = 8; | |
| 15151 | ✗ | tempguy.homing = 0; | |
| 15152 | ✗ | } | |
| 15153 | ✗ | else if(tempguy.type == eeDIG || tempguy.type == eeMANHAN) | |
| 15154 | { | ||
| 15155 | ✗ | if(tempguy.type == eeMANHAN) | |
| 15156 | ✗ | tempguy.step=50; | |
| 15157 | |||
| 15158 | ✗ | tempguy.hrate = 16; | |
| 15159 | ✗ | tempguy.homing = 0; | |
| 15160 | ✗ | } | |
| 15161 | ✗ | else if(tempguy.type == eeGLEEOK) | |
| 15162 | { | ||
| 15163 | ✗ | tempguy.rate = 2; | |
| 15164 | ✗ | tempguy.homing = 0; | |
| 15165 | ✗ | tempguy.hrate = 9; | |
| 15166 | ✗ | tempguy.step=89; | |
| 15167 | ✗ | } | |
| 15168 | ✗ | else if(tempguy.type == eeGHINI) | |
| 15169 | { | ||
| 15170 | ✗ | tempguy.rate = 4; | |
| 15171 | ✗ | tempguy.hrate = 12; | |
| 15172 | ✗ | tempguy.step=62; | |
| 15173 | ✗ | tempguy.homing = 0; | |
| 15174 | ✗ | } | |
| 15175 | |||
| 15176 | // Bigdig random rate fix | ||
| 15177 | ✗ | if(tempguy.type==eeDIG && tempguy.attributes[9]==1) | |
| 15178 | { | ||
| 15179 | ✗ | tempguy.rate = 2; | |
| 15180 | ✗ | } | |
| 15181 | ✗ | } | |
| 15182 | |||
| 15183 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(guyversion < 24) // November 2012 |
| 15184 | { | ||
| 15185 | ✗ | if(tempguy.type==eeLANM) | |
| 15186 | ✗ | tempguy.attributes[2] = 1; | |
| 15187 | ✗ | else if(tempguy.type==eeMOLD) | |
| 15188 | ✗ | tempguy.attributes[1] = 0; | |
| 15189 | ✗ | } | |
| 15190 | |||
| 15191 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
|
212480 | if(guyversion < 33) //Whistle defence did not exist before this version of 2.54. -Z |
| 15192 | { | ||
| 15193 |
2/2✓ Branch 0 taken 1400 times.
✓ Branch 1 taken 101000 times.
|
102400 | if(tempguy.type!=eeDIG) |
| 15194 | { | ||
| 15195 | 101000 | tempguy.defense[edefWhistle] = edIGNORE; //Might need to be ignore, universally. | |
| 15196 | 101000 | } | |
| 15197 | |||
| 15198 | 102400 | } | |
| 15199 | // does not seem to solve the issue! | ||
| 15200 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if ( Header->zelda_version <= 0x210 ) |
| 15201 | { | ||
| 15202 | ✗ | al_trace("Detected version %d for dodongo patch.\n",Header->zelda_version); | |
| 15203 | ✗ | if ( tempguy.type == eeDONGO ) | |
| 15204 | { | ||
| 15205 | ✗ | tempguy.deadsfx = 15; //In 2.10 and earlier, Dodongos used this as their death sound. | |
| 15206 | ✗ | } | |
| 15207 | ✗ | } | |
| 15208 | |||
| 15209 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
|
212480 | if(guyversion >= 42) |
| 15210 | { | ||
| 15211 |
2/2✓ Branch 0 taken 107520 times.
✓ Branch 1 taken 2560 times.
|
110080 | if(guyversion >= 47) |
| 15212 | { | ||
| 15213 |
1/2✓ Branch 0 taken 107520 times.
✗ Branch 1 not taken.
|
107520 | if(!p_igetl(&(tempguy.moveflags),f)) |
| 15214 | { | ||
| 15215 | ✗ | return qe_invalid; | |
| 15216 | } | ||
| 15217 | 107520 | } | |
| 15218 | else | ||
| 15219 | { | ||
| 15220 | byte fl; | ||
| 15221 |
1/2✓ Branch 0 taken 2560 times.
✗ Branch 1 not taken.
|
2560 | if(!p_getc(&fl,f)) |
| 15222 | { | ||
| 15223 | ✗ | return qe_invalid; | |
| 15224 | } | ||
| 15225 | 2560 | tempguy.moveflags = (move_flags)fl; | |
| 15226 | } | ||
| 15227 | 110080 | } | |
| 15228 | else | ||
| 15229 | { | ||
| 15230 |
7/8✓ Branch 0 taken 3056 times.
✓ Branch 1 taken 80670 times.
✓ Branch 2 taken 2717 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 958 times.
✓ Branch 5 taken 642 times.
✓ Branch 6 taken 498 times.
✓ Branch 7 taken 13859 times.
|
102400 | switch(tempguy.type) |
| 15231 | { | ||
| 15232 | //No gravity; floats over pits | ||
| 15233 | case eeTEK: case eePEAHAT: case eeROCK: case eeTRAP: | ||
| 15234 | case eePROJECTILE: case eeSPINTILE: case eeKEESE: case eeFIRE: | ||
| 15235 | //Special (bosses, etc) | ||
| 15236 | case eeFAIRY: case eeGUY: case eeNONE: case eeZORA: | ||
| 15237 | case eeAQUA: case eeDIG: case eeGHOMA: case eeGANON: | ||
| 15238 | case eePATRA: case eeGLEEOK: case eeMOLD: case eeMANHAN: | ||
| 15239 | 80670 | tempguy.moveflags = move_can_pitwalk; | |
| 15240 | 80670 | break; | |
| 15241 | //No gravity, but falls in pits | ||
| 15242 | case eeLEV: | ||
| 15243 | 958 | tempguy.moveflags = move_can_pitfall; | |
| 15244 | 958 | break; | |
| 15245 | //Bosses that respect pits | ||
| 15246 | case eeDONGO: | ||
| 15247 | 642 | tempguy.moveflags = move_obeys_grav; | |
| 15248 | 642 | break; | |
| 15249 | case eeLANM: | ||
| 15250 | 498 | tempguy.moveflags = move_none; | |
| 15251 | 498 | break; | |
| 15252 | //Gravity, floats over pits | ||
| 15253 | case eeWIZZ: case eeWALLM: case eeGHINI: | ||
| 15254 | 2717 | tempguy.moveflags = move_obeys_grav | move_can_pitwalk; | |
| 15255 | 2717 | break; | |
| 15256 | //Gravity and falls in pits | ||
| 15257 | case eeWALK: | ||
| 15258 |
4/4✓ Branch 0 taken 13164 times.
✓ Branch 1 taken 695 times.
✓ Branch 2 taken 529 times.
✓ Branch 3 taken 12635 times.
|
13859 | if (tempguy.attributes[8]==e9tPOLSVOICE||tempguy.attributes[8]==e9tVIRE) |
| 15259 | 1224 | break; | |
| 15260 | [[fallthrough]]; | ||
| 15261 | case eeOTHER: | ||
| 15262 | case eeSCRIPT01: case eeSCRIPT02: case eeSCRIPT03: case eeSCRIPT04: case eeSCRIPT05: | ||
| 15263 | case eeSCRIPT06: case eeSCRIPT07: case eeSCRIPT08: case eeSCRIPT09: case eeSCRIPT10: | ||
| 15264 | case eeSCRIPT11: case eeSCRIPT12: case eeSCRIPT13: case eeSCRIPT14: case eeSCRIPT15: | ||
| 15265 | case eeSCRIPT16: case eeSCRIPT17: case eeSCRIPT18: case eeSCRIPT19: case eeSCRIPT20: | ||
| 15266 | case eeFFRIENDLY01: case eeFFRIENDLY02: case eeFFRIENDLY03: case eeFFRIENDLY04: case eeFFRIENDLY05: | ||
| 15267 | case eeFFRIENDLY06: case eeFFRIENDLY07: case eeFFRIENDLY08: case eeFFRIENDLY09: case eeFFRIENDLY10: | ||
| 15268 | 15691 | tempguy.moveflags = move_obeys_grav | move_can_pitfall; | |
| 15269 | 15691 | } | |
| 15270 | } | ||
| 15271 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
|
212480 | if(guyversion < 43) |
| 15272 | { | ||
| 15273 |
2/2✓ Branch 0 taken 83387 times.
✓ Branch 1 taken 19013 times.
|
102400 | switch(tempguy.type) |
| 15274 | { | ||
| 15275 | //No gravity; floats over pits | ||
| 15276 | case eeTEK: case eePEAHAT: case eeROCK: case eeTRAP: | ||
| 15277 | case eePROJECTILE: case eeSPINTILE: case eeKEESE: case eeFIRE: | ||
| 15278 | //Special (bosses, etc) | ||
| 15279 | case eeFAIRY: case eeGUY: case eeNONE: case eeZORA: | ||
| 15280 | case eeAQUA: case eeDIG: case eeGHOMA: case eeGANON: | ||
| 15281 | case eePATRA: case eeGLEEOK: case eeMOLD: case eeMANHAN: | ||
| 15282 | case eeWIZZ: case eeWALLM: case eeGHINI: | ||
| 15283 | //Gravity, floats over pits | ||
| 15284 | 83387 | tempguy.moveflags |= move_can_waterwalk; | |
| 15285 | 83387 | tempguy.moveflags |= move_can_pitwalk; | |
| 15286 | 83387 | break; | |
| 15287 | } | ||
| 15288 | 102400 | } | |
| 15289 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
|
212480 | if (guyversion < 44) |
| 15290 | { | ||
| 15291 |
2/2✓ Branch 0 taken 101487 times.
✓ Branch 1 taken 913 times.
|
102400 | if ( tempguy.type == eeGHOMA ) |
| 15292 | { | ||
| 15293 | 913 | tempguy.flags |= guy_fade_instant; | |
| 15294 | 913 | } | |
| 15295 | 102400 | } | |
| 15296 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
|
212480 | if (guyversion > 44) |
| 15297 | { | ||
| 15298 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_getc(&(tempguy.spr_shadow),f)) |
| 15299 | { | ||
| 15300 | ✗ | return qe_invalid; | |
| 15301 | } | ||
| 15302 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_getc(&(tempguy.spr_death),f)) |
| 15303 | { | ||
| 15304 | ✗ | return qe_invalid; | |
| 15305 | } | ||
| 15306 |
1/2✓ Branch 0 taken 110080 times.
✗ Branch 1 not taken.
|
110080 | if(!p_getc(&(tempguy.spr_spawn),f)) |
| 15307 | { | ||
| 15308 | ✗ | return qe_invalid; | |
| 15309 | } | ||
| 15310 | 110080 | } | |
| 15311 | else | ||
| 15312 | { | ||
| 15313 |
2/2✓ Branch 0 taken 102003 times.
✓ Branch 1 taken 397 times.
|
102400 | tempguy.spr_shadow = (tempguy.type==eeROCK && tempguy.attributes[9]==1) ? iwLargeShadow : iwShadow; |
| 15314 | 102400 | tempguy.spr_death = iwDeath; | |
| 15315 | 102400 | tempguy.spr_spawn = iwSpawn; | |
| 15316 | } | ||
| 15317 | |||
| 15318 |
2/2✓ Branch 0 taken 110080 times.
✓ Branch 1 taken 102400 times.
|
212480 | if(guyversion < 46) |
| 15319 | { | ||
| 15320 |
4/4✓ Branch 0 taken 13859 times.
✓ Branch 1 taken 88541 times.
✓ Branch 2 taken 13164 times.
✓ Branch 3 taken 695 times.
|
102400 | if(tempguy.type == eeWALK && tempguy.attributes[8] == e9tPOLSVOICE) |
| 15321 | { | ||
| 15322 | 695 | tempguy.moveflags |= move_can_waterwalk; | |
| 15323 | 695 | } | |
| 15324 | 102400 | } | |
| 15325 | |||
| 15326 |
2/2✓ Branch 0 taken 107520 times.
✓ Branch 1 taken 104960 times.
|
212480 | if (guyversion < 47) |
| 15327 | { | ||
| 15328 |
4/4✓ Branch 0 taken 1430 times.
✓ Branch 1 taken 103530 times.
✓ Branch 2 taken 856 times.
✓ Branch 3 taken 574 times.
|
104960 | if (tempguy.type == eeDIG && tempguy.attributes[9]!=1) |
| 15329 | { | ||
| 15330 | 574 | tempguy.flags |= guy_ignore_kill_all; | |
| 15331 | 574 | } | |
| 15332 | 104960 | } | |
| 15333 | |||
| 15334 |
2/2✓ Branch 0 taken 86528 times.
✓ Branch 1 taken 125952 times.
|
212480 | if (guyversion < 49) |
| 15335 | { | ||
| 15336 |
8/8✓ Branch 0 taken 16458 times.
✓ Branch 1 taken 109494 times.
✓ Branch 2 taken 15984 times.
✓ Branch 3 taken 474 times.
✓ Branch 4 taken 15499 times.
✓ Branch 5 taken 485 times.
✓ Branch 6 taken 530 times.
✓ Branch 7 taken 14969 times.
|
125952 | if (tempguy.type == eeWALK && (tempguy.attributes[6]==e7tPERMJINX || tempguy.attributes[6]==e7tTEMPJINX || tempguy.attributes[6]==e7tUNJINX)) //BUBBLE CHECK |
| 15337 | { | ||
| 15338 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 713 times.
✓ Branch 2 taken 715 times.
✓ Branch 3 taken 61 times.
|
1489 | switch (tempguy.attributes[7]) { |
| 15339 | case 0: //Sword | ||
| 15340 | 713 | tempguy.attributes[7] = e8tSWORD; | |
| 15341 | 713 | break; | |
| 15342 | case 1: //Item | ||
| 15343 | 715 | tempguy.attributes[7] = e8tITEM; | |
| 15344 | 715 | break; | |
| 15345 | case 2: //Both | ||
| 15346 | 61 | tempguy.attributes[7] = e8tSWORD|e8tITEM; | |
| 15347 | 61 | break; | |
| 15348 | default: //this can actually happen since Misc8 can be set to any number. | ||
| 15349 | ✗ | tempguy.attributes[7] = 0; | |
| 15350 | ✗ | break; | |
| 15351 | } | ||
| 15352 | 1489 | } | |
| 15353 | 125952 | } | |
| 15354 | |||
| 15355 | //these could possible be combined but rather be safe... | ||
| 15356 |
2/2✓ Branch 0 taken 86528 times.
✓ Branch 1 taken 125952 times.
|
212480 | if (guyversion < 51) //reimport the firesfx, zoria ducked up. |
| 15357 | { | ||
| 15358 | 125952 | guy_update_firesfx(tempguy); | |
| 15359 | 125952 | } | |
| 15360 |
2/2✓ Branch 0 taken 125952 times.
✓ Branch 1 taken 86528 times.
|
212480 | if (guyversion < 52) |
| 15361 | { | ||
| 15362 | 125952 | guy_update_weaponflags(tempguy); | |
| 15363 | 125952 | } | |
| 15364 |
2/2✓ Branch 0 taken 83456 times.
✓ Branch 1 taken 3072 times.
|
86528 | else if(guyversion < 54) |
| 15365 | { | ||
| 15366 |
1/2✓ Branch 0 taken 3072 times.
✗ Branch 1 not taken.
|
3072 | if (!p_getc(&(tempguy.weap_data.unblockable), f)) |
| 15367 | ✗ | return qe_invalid; | |
| 15368 |
1/2✓ Branch 0 taken 3072 times.
✗ Branch 1 not taken.
|
3072 | if (!p_igetl(&(tempguy.weap_data.moveflags), f)) |
| 15369 | ✗ | return qe_invalid; | |
| 15370 |
1/2✓ Branch 0 taken 3072 times.
✗ Branch 1 not taken.
|
3072 | if (!p_igetl(&(tempguy.weap_data.override_flags), f)) |
| 15371 | ✗ | return qe_invalid; | |
| 15372 |
1/2✓ Branch 0 taken 3072 times.
✗ Branch 1 not taken.
|
3072 | if (!p_igetl(&(tempguy.weap_data.tilew), f)) |
| 15373 | ✗ | return qe_invalid; | |
| 15374 |
1/2✓ Branch 0 taken 3072 times.
✗ Branch 1 not taken.
|
3072 | if (!p_igetl(&(tempguy.weap_data.tileh), f)) |
| 15375 | ✗ | return qe_invalid; | |
| 15376 |
1/2✓ Branch 0 taken 3072 times.
✗ Branch 1 not taken.
|
3072 | if (!p_igetl(&(tempguy.weap_data.hxsz), f)) |
| 15377 | ✗ | return qe_invalid; | |
| 15378 |
1/2✓ Branch 0 taken 3072 times.
✗ Branch 1 not taken.
|
3072 | if (!p_igetl(&(tempguy.weap_data.hysz), f)) |
| 15379 | ✗ | return qe_invalid; | |
| 15380 |
1/2✓ Branch 0 taken 3072 times.
✗ Branch 1 not taken.
|
3072 | if (!p_igetl(&(tempguy.weap_data.hzsz), f)) |
| 15381 | ✗ | return qe_invalid; | |
| 15382 |
1/2✓ Branch 0 taken 3072 times.
✗ Branch 1 not taken.
|
3072 | if (!p_igetl(&(tempguy.weap_data.hxofs), f)) |
| 15383 | ✗ | return qe_invalid; | |
| 15384 |
1/2✓ Branch 0 taken 3072 times.
✗ Branch 1 not taken.
|
3072 | if (!p_igetl(&(tempguy.weap_data.hyofs), f)) |
| 15385 | ✗ | return qe_invalid; | |
| 15386 |
1/2✓ Branch 0 taken 3072 times.
✗ Branch 1 not taken.
|
3072 | if (!p_igetl(&(tempguy.weap_data.xofs), f)) |
| 15387 | ✗ | return qe_invalid; | |
| 15388 |
1/2✓ Branch 0 taken 3072 times.
✗ Branch 1 not taken.
|
3072 | if (!p_igetl(&(tempguy.weap_data.yofs), f)) |
| 15389 | ✗ | return qe_invalid; | |
| 15390 | int32_t temp_step; | ||
| 15391 |
1/2✓ Branch 0 taken 3072 times.
✗ Branch 1 not taken.
|
3072 | if (!p_igetl(&temp_step, f)) |
| 15392 | ✗ | return qe_invalid; | |
| 15393 | 3072 | tempguy.weap_data.step = zslongToFix(temp_step*100); | |
| 15394 |
2/2✓ Branch 0 taken 15360 times.
✓ Branch 1 taken 3072 times.
|
18432 | for (int32_t q = 0; q < WPNSPR_MAX; ++q) |
| 15395 | { | ||
| 15396 |
1/2✓ Branch 0 taken 15360 times.
✗ Branch 1 not taken.
|
15360 | if (!p_igetw(&(tempguy.weap_data.burnsprs[q]), f)) |
| 15397 | ✗ | return qe_invalid; | |
| 15398 |
1/2✓ Branch 0 taken 15360 times.
✗ Branch 1 not taken.
|
15360 | if (!p_igetw(&(tempguy.weap_data.light_rads[q]), f)) |
| 15399 | ✗ | return qe_invalid; | |
| 15400 | 15360 | } | |
| 15401 | 3072 | } | |
| 15402 |
2/2✓ Branch 0 taken 125952 times.
✓ Branch 1 taken 86528 times.
|
212480 | if (guyversion < 53) |
| 15403 | { | ||
| 15404 | 125952 | guy_update_weaponspecialsfx(tempguy); | |
| 15405 | 125952 | } | |
| 15406 | else | ||
| 15407 | { | ||
| 15408 |
1/2✓ Branch 0 taken 86528 times.
✗ Branch 1 not taken.
|
86528 | if (!p_getc(&(tempguy.specialsfx), f)) |
| 15409 | ✗ | return qe_invalid; | |
| 15410 | } | ||
| 15411 | |||
| 15412 |
2/2✓ Branch 0 taken 83456 times.
✓ Branch 1 taken 129024 times.
|
212480 | if(guyversion >= 54) |
| 15413 | { | ||
| 15414 |
1/2✓ Branch 0 taken 83456 times.
✗ Branch 1 not taken.
|
83456 | if(auto ret = read_weap_data(tempguy.weap_data, f)) |
| 15415 | ✗ | return ret; | |
| 15416 | 83456 | } | |
| 15417 | else | ||
| 15418 | { | ||
| 15419 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 129024 times.
|
129024 | SETFLAG(tempguy.weap_data.wflags, WFLAG_UPDATE_IGNITE_SPRITE, tempguy.flags & guy_burning_sprites); |
| 15420 | 129024 | tempguy.weap_data.flags |= wdata_set_step; | |
| 15421 |
2/2✓ Branch 0 taken 127437 times.
✓ Branch 1 taken 1587 times.
|
129024 | if(tempguy.weapon == ewRock) |
| 15422 | 1587 | tempguy.weap_data.wflags |= WFLAG_BREAK_ON_SOLID; | |
| 15423 | } | ||
| 15424 | |||
| 15425 |
1/2✓ Branch 0 taken 212480 times.
✗ Branch 1 not taken.
|
212480 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 15426 | { | ||
| 15427 | ✗ | tempguy.script = 0; | |
| 15428 | ✗ | for(int q = 0; q < 8; ++q) | |
| 15429 | ✗ | tempguy.initD[q] = 0; | |
| 15430 | ✗ | } | |
| 15431 | 212480 | guysbuf[i] = tempguy; | |
| 15432 | 212480 | } | |
| 15433 | 415 | } | |
| 15434 | |||
| 15435 | 415 | return 0; | |
| 15436 | 496 | } | |
| 15437 | |||
| 15438 | ✗ | void update_guy_1(guydata *tempguy) // November 2009 | |
| 15439 | { | ||
| 15440 | ✗ | bool doesntcount = false; | |
| 15441 | ✗ | tempguy->flags &= ~guy_weak_arrow; // Formerly 'weak to arrow' which wasn't implemented | |
| 15442 | |||
| 15443 | ✗ | switch(tempguy->type) | |
| 15444 | { | ||
| 15445 | case 1: //eeWALK | ||
| 15446 | ✗ | switch(tempguy->attributes[9]) | |
| 15447 | { | ||
| 15448 | case 0: //Stalfos | ||
| 15449 | ✗ | if(tempguy->attributes[0]==1) // Fires four projectiles at once | |
| 15450 | ✗ | tempguy->attributes[0]=4; | |
| 15451 | |||
| 15452 | ✗ | break; | |
| 15453 | |||
| 15454 | case 1: //Darknut | ||
| 15455 | ✗ | goto darknuts; | |
| 15456 | break; | ||
| 15457 | } | ||
| 15458 | |||
| 15459 | ✗ | tempguy->attributes[9] = 0; | |
| 15460 | ✗ | break; | |
| 15461 | |||
| 15462 | case 2: //eeSHOOT | ||
| 15463 | ✗ | tempguy->type = eeWALK; | |
| 15464 | |||
| 15465 | ✗ | switch(tempguy->attributes[9]) | |
| 15466 | { | ||
| 15467 | case 0: //Octorok | ||
| 15468 | ✗ | if(tempguy->attributes[0]==1||tempguy->attributes[0]==2) | |
| 15469 | { | ||
| 15470 | ✗ | tempguy->attributes[0]=e1tFIREOCTO; | |
| 15471 | ✗ | tempguy->attributes[1]=e2tFIREOCTO; | |
| 15472 | ✗ | } | |
| 15473 | ✗ | else tempguy->attributes[0] = 0; | |
| 15474 | |||
| 15475 | ✗ | tempguy->attributes[5]=tempguy->attributes[3]; | |
| 15476 | ✗ | tempguy->attributes[3]=tempguy->attributes[2]; | |
| 15477 | ✗ | tempguy->attributes[2]=0; | |
| 15478 | ✗ | break; | |
| 15479 | |||
| 15480 | case 1: // Moblin | ||
| 15481 | ✗ | tempguy->attributes[0] = 0; | |
| 15482 | ✗ | break; | |
| 15483 | |||
| 15484 | case 2: //Lynel | ||
| 15485 | ✗ | tempguy->attributes[5]=tempguy->attributes[0]+1; | |
| 15486 | ✗ | tempguy->attributes[0]=0; | |
| 15487 | ✗ | break; | |
| 15488 | |||
| 15489 | case 3: //Stalfos 2 | ||
| 15490 | ✗ | if(tempguy->attributes[0]==1) // Fires four projectiles at once | |
| 15491 | ✗ | tempguy->attributes[0]=e1t4SHOTS; | |
| 15492 | ✗ | else tempguy->attributes[0] = 0; | |
| 15493 | |||
| 15494 | ✗ | break; | |
| 15495 | |||
| 15496 | case 4: //Darknut 5 | ||
| 15497 | darknuts: | ||
| 15498 | ✗ | tempguy->defense[edefFIRE] = edIGNORE; | |
| 15499 | ✗ | tempguy->defense[edefBRANG] = edSTUNORCHINK; | |
| 15500 | ✗ | tempguy->defense[edefHOOKSHOT] = 0; | |
| 15501 | ✗ | tempguy->defense[edefARROW] = tempguy->defense[edefBYRNA] = tempguy->defense[edefREFROCK] = | |
| 15502 | ✗ | tempguy->defense[edefMAGIC] = tempguy->defense[edefSTOMP] = edCHINK; | |
| 15503 | |||
| 15504 | ✗ | if(tempguy->attributes[0]==1) | |
| 15505 | ✗ | tempguy->attributes[0]=2; | |
| 15506 | ✗ | else if(tempguy->attributes[0]==2) | |
| 15507 | { | ||
| 15508 | ✗ | tempguy->attributes[3]=tempguy->attributes[2]; | |
| 15509 | ✗ | tempguy->attributes[2]=tempguy->attributes[1]; | |
| 15510 | ✗ | tempguy->attributes[1]=e2tSPLIT; | |
| 15511 | ✗ | tempguy->attributes[0] = 0; | |
| 15512 | ✗ | } | |
| 15513 | ✗ | else tempguy->attributes[0] = 0; | |
| 15514 | |||
| 15515 | ✗ | tempguy->flags |= guy_shield_front; | |
| 15516 | |||
| 15517 | ✗ | if(!get_bit(deprecated_rules,qr_BRKBLSHLDS_DEP)) | |
| 15518 | ✗ | tempguy->flags &= ~guy_bkshield; | |
| 15519 | else | ||
| 15520 | ✗ | tempguy->flags |= guy_bkshield; | |
| 15521 | |||
| 15522 | ✗ | break; | |
| 15523 | } | ||
| 15524 | |||
| 15525 | ✗ | tempguy->attributes[9] = 0; | |
| 15526 | ✗ | break; | |
| 15527 | |||
| 15528 | /* | ||
| 15529 | case 9: //eeARMOS | ||
| 15530 | tempguy->family = eeWALK; | ||
| 15531 | break; | ||
| 15532 | */ | ||
| 15533 | case 11: //eeGEL | ||
| 15534 | case 33: //eeGELTRIB | ||
| 15535 | ✗ | if(tempguy->type==33) | |
| 15536 | { | ||
| 15537 | ✗ | tempguy->attributes[3] = 1; | |
| 15538 | |||
| 15539 | ✗ | if(get_bit(deprecated_rules, qr_OLDTRIBBLES_DEP)) //Old Tribbles | |
| 15540 | ✗ | tempguy->attributes[2] = tempguy->attributes[1]; | |
| 15541 | |||
| 15542 | ✗ | tempguy->attributes[1] = e2tTRIBBLE; | |
| 15543 | ✗ | } | |
| 15544 | else | ||
| 15545 | { | ||
| 15546 | ✗ | tempguy->attributes[3] = 0; | |
| 15547 | ✗ | tempguy->attributes[2] = 0; | |
| 15548 | ✗ | tempguy->attributes[1] = 0; | |
| 15549 | } | ||
| 15550 | |||
| 15551 | ✗ | tempguy->type = eeWALK; | |
| 15552 | |||
| 15553 | ✗ | if(tempguy->attributes[0]) | |
| 15554 | { | ||
| 15555 | ✗ | tempguy->attributes[0]=1; | |
| 15556 | ✗ | tempguy->weapon = ewFireTrail; | |
| 15557 | ✗ | } | |
| 15558 | |||
| 15559 | ✗ | break; | |
| 15560 | |||
| 15561 | case 34: //eeZOLTRIB | ||
| 15562 | case 12: //eeZOL | ||
| 15563 | ✗ | tempguy->attributes[3]=tempguy->attributes[2]; | |
| 15564 | ✗ | tempguy->attributes[2]=tempguy->attributes[1]; | |
| 15565 | ✗ | tempguy->type = eeWALK; | |
| 15566 | ✗ | tempguy->attributes[1]=e2tSPLITHIT; | |
| 15567 | |||
| 15568 | ✗ | if(tempguy->attributes[0]) | |
| 15569 | { | ||
| 15570 | ✗ | tempguy->attributes[0]=1; | |
| 15571 | ✗ | tempguy->weapon = ewFireTrail; | |
| 15572 | ✗ | } | |
| 15573 | |||
| 15574 | ✗ | break; | |
| 15575 | |||
| 15576 | case 13: //eeROPE | ||
| 15577 | ✗ | tempguy->type = eeWALK; | |
| 15578 | ✗ | tempguy->attributes[8] = e9tROPE; | |
| 15579 | |||
| 15580 | ✗ | if(tempguy->attributes[0]) | |
| 15581 | { | ||
| 15582 | ✗ | tempguy->attributes[3] = tempguy->attributes[2]; | |
| 15583 | ✗ | tempguy->attributes[2] = tempguy->attributes[1]; | |
| 15584 | ✗ | tempguy->attributes[1] = e2tBOMBCHU; | |
| 15585 | ✗ | } | |
| 15586 | |||
| 15587 | ✗ | tempguy->attributes[0] = 0; | |
| 15588 | ✗ | break; | |
| 15589 | |||
| 15590 | case 14: //eeGORIYA | ||
| 15591 | ✗ | tempguy->type = eeWALK; | |
| 15592 | |||
| 15593 | ✗ | if(tempguy->attributes[0]!=2) tempguy->attributes[0] = 0; | |
| 15594 | |||
| 15595 | ✗ | break; | |
| 15596 | |||
| 15597 | case 17: //eeBUBBLE | ||
| 15598 | ✗ | tempguy->type = eeWALK; | |
| 15599 | ✗ | tempguy->attributes[7] = tempguy->attributes[1]; | |
| 15600 | ✗ | tempguy->attributes[6] = tempguy->attributes[0] + 1; | |
| 15601 | ✗ | tempguy->attributes[0] = tempguy->attributes[1] = 0; | |
| 15602 | |||
| 15603 | //fallthrogh | ||
| 15604 | case eeTRAP: | ||
| 15605 | case eeROCK: | ||
| 15606 | ✗ | doesntcount = true; | |
| 15607 | ✗ | break; | |
| 15608 | |||
| 15609 | case 35: //eeVIRETRIB | ||
| 15610 | case 18: //eeVIRE | ||
| 15611 | ✗ | tempguy->type = eeWALK; | |
| 15612 | ✗ | tempguy->attributes[3]=tempguy->attributes[2]; | |
| 15613 | ✗ | tempguy->attributes[2]=tempguy->attributes[1]; | |
| 15614 | ✗ | tempguy->attributes[1]=e2tSPLITHIT; | |
| 15615 | ✗ | tempguy->attributes[8]=e9tVIRE; | |
| 15616 | ✗ | break; | |
| 15617 | |||
| 15618 | case 19: //eeLIKE | ||
| 15619 | ✗ | tempguy->type = eeWALK; | |
| 15620 | ✗ | tempguy->attributes[6] = e7tEATITEMS; | |
| 15621 | ✗ | tempguy->attributes[7]=95; | |
| 15622 | ✗ | break; | |
| 15623 | |||
| 15624 | case 20: //eePOLSV | ||
| 15625 | ✗ | tempguy->defense[edefBRANG] = edSTUNORCHINK; | |
| 15626 | ✗ | tempguy->defense[edefBOMB] = tempguy->defense[edefSBOMB] = tempguy->defense[edefFIRE] = edIGNORE; | |
| 15627 | ✗ | tempguy->defense[edefMAGIC] = tempguy->defense[edefBYRNA] = edCHINK; | |
| 15628 | ✗ | tempguy->defense[edefARROW] = ed1HKO; | |
| 15629 | ✗ | tempguy->defense[edefHOOKSHOT] = edSTUNONLY; | |
| 15630 | ✗ | tempguy->type = eeWALK; | |
| 15631 | ✗ | tempguy->attributes[8] = e9tPOLSVOICE; | |
| 15632 | ✗ | tempguy->rate = 4; | |
| 15633 | ✗ | tempguy->homing = 32; | |
| 15634 | ✗ | tempguy->hrate = 10; | |
| 15635 | ✗ | tempguy->grumble = 0; | |
| 15636 | ✗ | break; | |
| 15637 | |||
| 15638 | case eeWIZZ: | ||
| 15639 | ✗ | if(tempguy->attributes[3]) | |
| 15640 | { | ||
| 15641 | ✗ | for(int32_t i=0; i < edefLAST; i++) | |
| 15642 | ✗ | tempguy->defense[i] = (i != edefREFBEAM && i != edefREFMAGIC && i != edefQUAKE) ? edIGNORE : 0; | |
| 15643 | ✗ | } | |
| 15644 | else | ||
| 15645 | { | ||
| 15646 | ✗ | tempguy->defense[edefBRANG] = edSTUNORCHINK; | |
| 15647 | ✗ | tempguy->defense[edefMAGIC] = edCHINK; | |
| 15648 | ✗ | tempguy->defense[edefHOOKSHOT] = edSTUNONLY; | |
| 15649 | ✗ | tempguy->defense[edefARROW] = tempguy->defense[edefFIRE] = | |
| 15650 | ✗ | tempguy->defense[edefWAND] = tempguy->defense[edefBYRNA] = edIGNORE; | |
| 15651 | } | ||
| 15652 | |||
| 15653 | ✗ | break; | |
| 15654 | |||
| 15655 | case eePEAHAT: | ||
| 15656 | ✗ | tempguy->flags &= ~(guy_superman|guy_sbombonly); | |
| 15657 | |||
| 15658 | ✗ | if(!(tempguy->flags & guy_bhit)) | |
| 15659 | ✗ | tempguy->defense[edefBRANG] = edSTUNONLY; | |
| 15660 | |||
| 15661 | ✗ | break; | |
| 15662 | |||
| 15663 | case eeLEV: | ||
| 15664 | ✗ | tempguy->defense[edefSTOMP] = edCHINK; | |
| 15665 | ✗ | break; | |
| 15666 | } | ||
| 15667 | |||
| 15668 | // Old flags | ||
| 15669 | ✗ | if(tempguy->flags & guy_superman) | |
| 15670 | { | ||
| 15671 | ✗ | for(int32_t i = 0; i < edefLAST; i++) | |
| 15672 | ✗ | if(!(i==edefSBOMB && (tempguy->flags & guy_sbombonly))) | |
| 15673 | ✗ | tempguy->defense[i] = (i==edefBRANG && tempguy->defense[i] != edIGNORE | |
| 15674 | ✗ | && tempguy->type != eeROCK && tempguy->type != eeTRAP | |
| 15675 | ✗ | && tempguy->type != eePROJECTILE) ? edSTUNORIGNORE : edIGNORE; | |
| 15676 | ✗ | } | |
| 15677 | |||
| 15678 | ✗ | tempguy->flags &= ~(guy_superman|guy_sbombonly); | |
| 15679 | |||
| 15680 | ✗ | if(doesntcount) | |
| 15681 | ✗ | tempguy->flags |= (guy_doesnt_count); | |
| 15682 | ✗ | } | |
| 15683 | |||
| 15684 | 1170424 | int32_t readmapscreen_old(PACKFILE *f, zquestheader *Header, mapscr *temp_mapscr, word version, int scrind, bool keep_music) | |
| 15685 | { | ||
| 15686 | 1170424 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_maps); | |
| 15687 | |||
| 15688 | byte tempbyte, padding; | ||
| 15689 | word wpadding; | ||
| 15690 | int32_t extras, secretcombos; | ||
| 15691 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1170424 times.
|
1170424 | if(!p_getc(&(temp_mapscr->valid),f)) |
| 15692 | { | ||
| 15693 | ✗ | return qe_invalid; | |
| 15694 | } | ||
| 15695 | |||
| 15696 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1170424 times.
|
1170424 | if(!p_getc(&(temp_mapscr->guy),f)) |
| 15697 | ✗ | return qe_invalid; | |
| 15698 | 1170424 | temp_mapscr->guytile = -1; //signal to use default guy values | |
| 15699 |
2/2✓ Branch 0 taken 1169824 times.
✓ Branch 1 taken 600 times.
|
1170424 | SETFLAG(temp_mapscr->roomflags,RFL_ALWAYS_GUY,temp_mapscr->guy==gFAIRY); |
| 15700 |
4/4✓ Branch 0 taken 600 times.
✓ Branch 1 taken 1169824 times.
✓ Branch 2 taken 62 times.
✓ Branch 3 taken 538 times.
|
1170424 | SETFLAG(temp_mapscr->roomflags,RFL_GUYFIRES,temp_mapscr->guy!=gFAIRY || !get_qr(qr_NOFAIRYGUYFIRES)); |
| 15701 | |||
| 15702 |
5/6✓ Branch 0 taken 1148248 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1145528 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1170424 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<146))) |
| 15703 | { | ||
| 15704 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22176 times.
|
22176 | if(!p_getc(&tempbyte,f)) |
| 15705 | { | ||
| 15706 | ✗ | return qe_invalid; | |
| 15707 | } | ||
| 15708 | |||
| 15709 | 22176 | temp_mapscr->str=tempbyte; | |
| 15710 | 22176 | } | |
| 15711 | else | ||
| 15712 | { | ||
| 15713 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1148248 times.
|
1148248 | if(!p_igetw(&(temp_mapscr->str),f)) |
| 15714 | { | ||
| 15715 | ✗ | return qe_invalid; | |
| 15716 | } | ||
| 15717 | } | ||
| 15718 | |||
| 15719 |
1/2✓ Branch 0 taken 1170424 times.
✗ Branch 1 not taken.
|
1170424 | if(!p_getc(&(temp_mapscr->room),f)) |
| 15720 | { | ||
| 15721 | ✗ | return qe_invalid; | |
| 15722 | } | ||
| 15723 | |||
| 15724 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1170424 times.
|
1170424 | if(!p_getc(&(temp_mapscr->item),f)) |
| 15725 | { | ||
| 15726 | ✗ | return qe_invalid; | |
| 15727 | } | ||
| 15728 | |||
| 15729 |
3/6✓ Branch 0 taken 650352 times.
✓ Branch 1 taken 520072 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 650352 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1170424 | if(Header->zelda_version < 0x211 || (Header->zelda_version == 0x211 && Header->build < 14)) |
| 15730 | { | ||
| 15731 | 520072 | temp_mapscr->hasitem = (temp_mapscr->item != 0) ? 1 : 0; | |
| 15732 | 520072 | } | |
| 15733 | else | ||
| 15734 | { | ||
| 15735 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650352 times.
|
650352 | if(!p_getc(&(temp_mapscr->hasitem),f)) |
| 15736 | ✗ | return qe_invalid; | |
| 15737 | } | ||
| 15738 | |||
| 15739 |
3/4✓ Branch 0 taken 1148248 times.
✓ Branch 1 taken 22176 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1173144 | if((Header->zelda_version < 0x192)|| |
| 15740 |
2/2✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1145528 times.
|
1148248 | ((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 15741 | { | ||
| 15742 |
1/2✓ Branch 0 taken 22176 times.
✗ Branch 1 not taken.
|
22176 | if(!p_getc(&tempbyte,f)) |
| 15743 | { | ||
| 15744 | ✗ | return qe_invalid; | |
| 15745 | } | ||
| 15746 | 22176 | } | |
| 15747 | |||
| 15748 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1170424 times.
|
1170424 | if(!p_getc(&(temp_mapscr->tilewarptype[0]),f)) |
| 15749 | { | ||
| 15750 | ✗ | return qe_invalid; | |
| 15751 | } | ||
| 15752 | |||
| 15753 |
2/2✓ Branch 0 taken 1145528 times.
✓ Branch 1 taken 24896 times.
|
1170424 | if(Header->zelda_version < 0x193) |
| 15754 | { | ||
| 15755 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24896 times.
|
24896 | if(!p_getc(&tempbyte,f)) |
| 15756 | { | ||
| 15757 | ✗ | return qe_invalid; | |
| 15758 | } | ||
| 15759 | 24896 | } | |
| 15760 | |||
| 15761 |
3/6✓ Branch 0 taken 520072 times.
✓ Branch 1 taken 650352 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 520072 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15762 | { | ||
| 15763 |
2/2✓ Branch 0 taken 1951056 times.
✓ Branch 1 taken 650352 times.
|
2601408 | for(int32_t i=1; i<4; i++) |
| 15764 | { | ||
| 15765 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1951056 times.
|
1951056 | if(!p_getc(&(temp_mapscr->tilewarptype[i]),f)) |
| 15766 | { | ||
| 15767 | ✗ | return qe_invalid; | |
| 15768 | } | ||
| 15769 | 1951056 | } | |
| 15770 | 650352 | } | |
| 15771 | else | ||
| 15772 | { | ||
| 15773 | 520072 | temp_mapscr->tilewarptype[1]=0; | |
| 15774 | 520072 | temp_mapscr->tilewarptype[2]=0; | |
| 15775 | 520072 | temp_mapscr->tilewarptype[3]=0; | |
| 15776 | } | ||
| 15777 | |||
| 15778 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1145528 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>153))) |
| 15779 | { | ||
| 15780 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1148248 times.
|
1148248 | if(!p_igetw(&(temp_mapscr->door_combo_set),f)) |
| 15781 | { | ||
| 15782 | ✗ | return qe_invalid; | |
| 15783 | } | ||
| 15784 | 1148248 | } | |
| 15785 | |||
| 15786 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1170424 times.
|
1170424 | if(!p_getc(&(temp_mapscr->warpreturnx[0]),f)) |
| 15787 | { | ||
| 15788 | ✗ | return qe_invalid; | |
| 15789 | } | ||
| 15790 | |||
| 15791 | 1170424 | temp_mapscr->warpreturnx[1]=0; | |
| 15792 | 1170424 | temp_mapscr->warpreturnx[2]=0; | |
| 15793 | 1170424 | temp_mapscr->warpreturnx[3]=0; | |
| 15794 | |||
| 15795 |
3/6✓ Branch 0 taken 520072 times.
✓ Branch 1 taken 650352 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 520072 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15796 | { | ||
| 15797 |
2/2✓ Branch 0 taken 1951056 times.
✓ Branch 1 taken 650352 times.
|
2601408 | for(int32_t i=1; i<4; i++) |
| 15798 | { | ||
| 15799 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1951056 times.
|
1951056 | if(!p_getc(&(temp_mapscr->warpreturnx[i]),f)) |
| 15800 | { | ||
| 15801 | ✗ | return qe_invalid; | |
| 15802 | } | ||
| 15803 | 1951056 | } | |
| 15804 | 650352 | } | |
| 15805 | |||
| 15806 |
1/2✓ Branch 0 taken 1170424 times.
✗ Branch 1 not taken.
|
1170424 | if(!p_getc(&(temp_mapscr->warpreturny[0]),f)) |
| 15807 | { | ||
| 15808 | ✗ | return qe_invalid; | |
| 15809 | } | ||
| 15810 | |||
| 15811 | 1170424 | temp_mapscr->warpreturny[1]=0; | |
| 15812 | 1170424 | temp_mapscr->warpreturny[2]=0; | |
| 15813 | 1170424 | temp_mapscr->warpreturny[3]=0; | |
| 15814 | |||
| 15815 |
3/6✓ Branch 0 taken 520072 times.
✓ Branch 1 taken 650352 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 520072 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15816 | { | ||
| 15817 |
2/2✓ Branch 0 taken 1951056 times.
✓ Branch 1 taken 650352 times.
|
2601408 | for(int32_t i=1; i<4; i++) |
| 15818 | { | ||
| 15819 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1951056 times.
|
1951056 | if(!p_getc(&(temp_mapscr->warpreturny[i]),f)) |
| 15820 | { | ||
| 15821 | ✗ | return qe_invalid; | |
| 15822 | } | ||
| 15823 | 1951056 | } | |
| 15824 | |||
| 15825 |
1/2✓ Branch 0 taken 650352 times.
✗ Branch 1 not taken.
|
650352 | if(version>=18) |
| 15826 | { | ||
| 15827 |
1/2✓ Branch 0 taken 650352 times.
✗ Branch 1 not taken.
|
650352 | if(!p_igetw(&temp_mapscr->warpreturnc,f)) |
| 15828 | { | ||
| 15829 | ✗ | return qe_invalid; | |
| 15830 | } | ||
| 15831 | 650352 | } | |
| 15832 | else | ||
| 15833 | { | ||
| 15834 | byte temp; | ||
| 15835 | |||
| 15836 | ✗ | if(!p_getc(&temp,f)) | |
| 15837 | { | ||
| 15838 | ✗ | return qe_invalid; | |
| 15839 | } | ||
| 15840 | |||
| 15841 | ✗ | temp_mapscr->warpreturnc=temp<<8|temp; | |
| 15842 | } | ||
| 15843 | 650352 | } | |
| 15844 | |||
| 15845 |
1/2✓ Branch 0 taken 1170424 times.
✗ Branch 1 not taken.
|
1170424 | if(!p_getc(&(temp_mapscr->stairx),f)) |
| 15846 | |||
| 15847 | { | ||
| 15848 | ✗ | return qe_invalid; | |
| 15849 | } | ||
| 15850 | |||
| 15851 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1170424 times.
|
1170424 | if(!p_getc(&(temp_mapscr->stairy),f)) |
| 15852 | { | ||
| 15853 | ✗ | return qe_invalid; | |
| 15854 | } | ||
| 15855 | |||
| 15856 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1170424 times.
|
1170424 | if(!p_getc(&(temp_mapscr->itemx),f)) |
| 15857 | { | ||
| 15858 | ✗ | return qe_invalid; | |
| 15859 | } | ||
| 15860 | |||
| 15861 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1170424 times.
|
1170424 | if(!p_getc(&(temp_mapscr->itemy),f)) |
| 15862 | { | ||
| 15863 | ✗ | return qe_invalid; | |
| 15864 | } | ||
| 15865 | |||
| 15866 |
2/2✓ Branch 0 taken 650352 times.
✓ Branch 1 taken 520072 times.
|
1170424 | if(version > 15) // February 2009 |
| 15867 | { | ||
| 15868 |
1/2✓ Branch 0 taken 650352 times.
✗ Branch 1 not taken.
|
650352 | if(!p_igetw(&(temp_mapscr->color),f)) |
| 15869 | { | ||
| 15870 | ✗ | return qe_invalid; | |
| 15871 | } | ||
| 15872 | 650352 | } | |
| 15873 | else | ||
| 15874 | { | ||
| 15875 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 520072 times.
|
520072 | if(!p_getc(& tempbyte,f)) |
| 15876 | { | ||
| 15877 | ✗ | return qe_invalid; | |
| 15878 | } | ||
| 15879 | |||
| 15880 | 520072 | temp_mapscr->color = (word) tempbyte; | |
| 15881 | } | ||
| 15882 | |||
| 15883 |
1/2✓ Branch 0 taken 1170424 times.
✗ Branch 1 not taken.
|
1170424 | if(!p_getc(&(temp_mapscr->flags11),f)) |
| 15884 | { | ||
| 15885 | ✗ | return qe_invalid; | |
| 15886 | } | ||
| 15887 | |||
| 15888 |
2/2✓ Branch 0 taken 4681696 times.
✓ Branch 1 taken 1170424 times.
|
5852120 | for(int32_t k=0; k<4; k++) |
| 15889 | { | ||
| 15890 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4681696 times.
|
4681696 | if(!p_getc(&(temp_mapscr->door[k]),f)) |
| 15891 | { | ||
| 15892 | ✗ | return qe_invalid; | |
| 15893 | |||
| 15894 | } | ||
| 15895 | 4681696 | } | |
| 15896 | |||
| 15897 |
2/2✓ Branch 0 taken 520072 times.
✓ Branch 1 taken 650352 times.
|
1170424 | if(version <= 11) |
| 15898 | { | ||
| 15899 |
1/2✓ Branch 0 taken 520072 times.
✗ Branch 1 not taken.
|
520072 | if(!p_getc(&(tempbyte),f)) |
| 15900 | { | ||
| 15901 | ✗ | return qe_invalid; | |
| 15902 | } | ||
| 15903 | |||
| 15904 | 520072 | temp_mapscr->tilewarpdmap[0]=(word)tempbyte; | |
| 15905 | |||
| 15906 |
2/6✓ Branch 0 taken 520072 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 520072 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
520072 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15907 | { | ||
| 15908 | ✗ | for(int32_t i=1; i<4; i++) | |
| 15909 | { | ||
| 15910 | ✗ | if(!p_getc(&(tempbyte),f)) | |
| 15911 | { | ||
| 15912 | ✗ | return qe_invalid; | |
| 15913 | } | ||
| 15914 | |||
| 15915 | ✗ | temp_mapscr->tilewarpdmap[i]=(word)tempbyte; | |
| 15916 | ✗ | } | |
| 15917 | ✗ | } | |
| 15918 | else | ||
| 15919 | { | ||
| 15920 | 520072 | temp_mapscr->tilewarpdmap[1]=0; | |
| 15921 | 520072 | temp_mapscr->tilewarpdmap[2]=0; | |
| 15922 | 520072 | temp_mapscr->tilewarpdmap[3]=0; | |
| 15923 | } | ||
| 15924 | 520072 | } | |
| 15925 | else | ||
| 15926 | { | ||
| 15927 |
2/2✓ Branch 0 taken 2601408 times.
✓ Branch 1 taken 650352 times.
|
3251760 | for(int32_t i=0; i<4; i++) |
| 15928 | { | ||
| 15929 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2601408 times.
|
2601408 | if(!p_igetw(&(temp_mapscr->tilewarpdmap[i]),f)) |
| 15930 | { | ||
| 15931 | ✗ | return qe_invalid; | |
| 15932 | } | ||
| 15933 | 2601408 | } | |
| 15934 | } | ||
| 15935 | |||
| 15936 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1170424 times.
|
1170424 | if(!p_getc(&(temp_mapscr->tilewarpscr[0]),f)) |
| 15937 | { | ||
| 15938 | ✗ | return qe_invalid; | |
| 15939 | } | ||
| 15940 | |||
| 15941 |
3/6✓ Branch 0 taken 520072 times.
✓ Branch 1 taken 650352 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 520072 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15942 | { | ||
| 15943 |
2/2✓ Branch 0 taken 1951056 times.
✓ Branch 1 taken 650352 times.
|
2601408 | for(int32_t i=1; i<4; i++) |
| 15944 | { | ||
| 15945 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1951056 times.
|
1951056 | if(!p_getc(&(temp_mapscr->tilewarpscr[i]),f)) |
| 15946 | { | ||
| 15947 | ✗ | return qe_invalid; | |
| 15948 | } | ||
| 15949 | 1951056 | } | |
| 15950 | 650352 | } | |
| 15951 | else | ||
| 15952 | { | ||
| 15953 | 520072 | temp_mapscr->tilewarpscr[1]=0; | |
| 15954 | 520072 | temp_mapscr->tilewarpscr[2]=0; | |
| 15955 | 520072 | temp_mapscr->tilewarpscr[3]=0; | |
| 15956 | } | ||
| 15957 | |||
| 15958 |
2/2✓ Branch 0 taken 650352 times.
✓ Branch 1 taken 520072 times.
|
1170424 | if(version >= 15) |
| 15959 | { | ||
| 15960 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650352 times.
|
650352 | if(!p_getc(&(temp_mapscr->tilewarpoverlayflags),f)) |
| 15961 | { | ||
| 15962 | ✗ | return qe_invalid; | |
| 15963 | } | ||
| 15964 | 650352 | } | |
| 15965 | else | ||
| 15966 | { | ||
| 15967 | 520072 | temp_mapscr->tilewarpoverlayflags=0; | |
| 15968 | } | ||
| 15969 | |||
| 15970 |
1/2✓ Branch 0 taken 1170424 times.
✗ Branch 1 not taken.
|
1170424 | if(!p_getc(&(temp_mapscr->exitdir),f)) |
| 15971 | { | ||
| 15972 | ✗ | return qe_invalid; | |
| 15973 | } | ||
| 15974 | |||
| 15975 |
2/2✓ Branch 0 taken 1145528 times.
✓ Branch 1 taken 24896 times.
|
1170424 | if(Header->zelda_version < 0x193) |
| 15976 | { | ||
| 15977 |
1/2✓ Branch 0 taken 24896 times.
✗ Branch 1 not taken.
|
24896 | if(!p_getc(&tempbyte,f)) |
| 15978 | { | ||
| 15979 | ✗ | return qe_invalid; | |
| 15980 | } | ||
| 15981 | |||
| 15982 | 24896 | } | |
| 15983 | |||
| 15984 |
4/6✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1167704 times.
✓ Branch 2 taken 2720 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version == 0x192)&&(Header->build>145)&&(Header->build<154)) |
| 15985 | { | ||
| 15986 | ✗ | if(!p_getc(&padding,f)) | |
| 15987 | { | ||
| 15988 | ✗ | return qe_invalid; | |
| 15989 | } | ||
| 15990 | ✗ | } | |
| 15991 | |||
| 15992 |
2/2✓ Branch 0 taken 11704240 times.
✓ Branch 1 taken 1170424 times.
|
12874664 | for(int32_t k=0; k<10; k++) |
| 15993 | { | ||
| 15994 |
5/6✓ Branch 0 taken 11482480 times.
✓ Branch 1 taken 221760 times.
✓ Branch 2 taken 27200 times.
✓ Branch 3 taken 11455280 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 27200 times.
|
11704240 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<10))) |
| 15995 | { | ||
| 15996 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 221760 times.
|
221760 | if(!p_getc(&tempbyte,f)) |
| 15997 | { | ||
| 15998 | ✗ | return qe_invalid; | |
| 15999 | } | ||
| 16000 | |||
| 16001 | 221760 | temp_mapscr->enemy[k]=tempbyte; | |
| 16002 | |||
| 16003 | // 76 is the highest enemy id possible to set in 1.90. Anything higher must have come | ||
| 16004 | // from corrupting when 1.90 saved the quest. | ||
| 16005 | // https://discord.com/channels/876899628556091432/1287580827164737658 | ||
| 16006 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 221760 times.
|
221760 | if (Header->zelda_version <= 0x190) |
| 16007 | { | ||
| 16008 |
1/2✓ Branch 0 taken 221760 times.
✗ Branch 1 not taken.
|
221760 | if (temp_mapscr->enemy[k] > 76) |
| 16009 | { | ||
| 16010 | ✗ | temp_mapscr->enemy[k] = 0; | |
| 16011 | ✗ | } | |
| 16012 | 221760 | } | |
| 16013 | 221760 | } | |
| 16014 | else | ||
| 16015 | { | ||
| 16016 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11482480 times.
|
11482480 | if(!p_igetw(&(temp_mapscr->enemy[k]),f)) |
| 16017 | { | ||
| 16018 | ✗ | return qe_invalid; | |
| 16019 | } | ||
| 16020 | } | ||
| 16021 | |||
| 16022 |
5/6✓ Branch 0 taken 11482480 times.
✓ Branch 1 taken 221760 times.
✓ Branch 2 taken 27200 times.
✓ Branch 3 taken 11455280 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 27200 times.
|
11704240 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<108))) |
| 16023 | { | ||
| 16024 | //using enumerations here is dangerous | ||
| 16025 | //very easy to break old quests -DD | ||
| 16026 |
2/2✓ Branch 0 taken 1342 times.
✓ Branch 1 taken 220418 times.
|
221760 | if(temp_mapscr->enemy[k]>=57) //old eGOHMA1 |
| 16027 | { | ||
| 16028 | 1342 | temp_mapscr->enemy[k]+=5; | |
| 16029 | 1342 | } | |
| 16030 |
2/2✓ Branch 0 taken 220324 times.
✓ Branch 1 taken 94 times.
|
220418 | else if(temp_mapscr->enemy[k]>=52) //old eGLEEOK2 |
| 16031 | { | ||
| 16032 | 94 | temp_mapscr->enemy[k]+=1; | |
| 16033 | 94 | } | |
| 16034 | 221760 | } | |
| 16035 | |||
| 16036 |
2/2✓ Branch 0 taken 6503520 times.
✓ Branch 1 taken 5200720 times.
|
11704240 | if(version < 9) |
| 16037 | { | ||
| 16038 |
2/2✓ Branch 0 taken 4932265 times.
✓ Branch 1 taken 268455 times.
|
5200720 | if(temp_mapscr->enemy[k]>0) |
| 16039 | { | ||
| 16040 | 268455 | temp_mapscr->enemy[k]+=10; | |
| 16041 | 268455 | } | |
| 16042 | 5200720 | } | |
| 16043 | //don't read in any invalid data | ||
| 16044 |
2/2✓ Branch 0 taken 11703800 times.
✓ Branch 1 taken 440 times.
|
11704240 | if ( ((unsigned)temp_mapscr->enemy[k]) > MAXGUYS ) |
| 16045 | { | ||
| 16046 | 440 | al_trace("Tried to read an invalid enemy ID (%d) for enemy[%d]. This has been cleared to 0.\n", temp_mapscr->enemy[k], k); | |
| 16047 | 440 | temp_mapscr->enemy[k] = 0; | |
| 16048 | 440 | } | |
| 16049 | 11704240 | } | |
| 16050 | |||
| 16051 |
1/2✓ Branch 0 taken 1170424 times.
✗ Branch 1 not taken.
|
1170424 | if(!p_getc(&(temp_mapscr->pattern),f)) |
| 16052 | { | ||
| 16053 | ✗ | return qe_invalid; | |
| 16054 | } | ||
| 16055 | |||
| 16056 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1170424 times.
|
1170424 | if(!p_getc(&(temp_mapscr->sidewarptype[0]),f)) |
| 16057 | { | ||
| 16058 | ✗ | return qe_invalid; | |
| 16059 | } | ||
| 16060 | |||
| 16061 |
3/6✓ Branch 0 taken 520072 times.
✓ Branch 1 taken 650352 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 520072 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 16062 | { | ||
| 16063 |
2/2✓ Branch 0 taken 1951056 times.
✓ Branch 1 taken 650352 times.
|
2601408 | for(int32_t i=1; i<4; i++) |
| 16064 | { | ||
| 16065 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1951056 times.
|
1951056 | if(!p_getc(&(temp_mapscr->sidewarptype[i]),f)) |
| 16066 | { | ||
| 16067 | ✗ | return qe_invalid; | |
| 16068 | } | ||
| 16069 | 1951056 | } | |
| 16070 | 650352 | } | |
| 16071 | else | ||
| 16072 | { | ||
| 16073 | 520072 | temp_mapscr->sidewarptype[1]=0; | |
| 16074 | 520072 | temp_mapscr->sidewarptype[2]=0; | |
| 16075 | 520072 | temp_mapscr->sidewarptype[3]=0; | |
| 16076 | } | ||
| 16077 | |||
| 16078 |
2/2✓ Branch 0 taken 650352 times.
✓ Branch 1 taken 520072 times.
|
1170424 | if(version >= 15) |
| 16079 | { | ||
| 16080 |
1/2✓ Branch 0 taken 650352 times.
✗ Branch 1 not taken.
|
650352 | if(!p_getc(&(temp_mapscr->sidewarpoverlayflags),f)) |
| 16081 | { | ||
| 16082 | ✗ | return qe_invalid; | |
| 16083 | } | ||
| 16084 | 650352 | } | |
| 16085 | else | ||
| 16086 | { | ||
| 16087 | 520072 | temp_mapscr->sidewarpoverlayflags=0; | |
| 16088 | } | ||
| 16089 | |||
| 16090 |
1/2✓ Branch 0 taken 1170424 times.
✗ Branch 1 not taken.
|
1170424 | if(!p_getc(&(temp_mapscr->warparrivalx),f)) |
| 16091 | { | ||
| 16092 | ✗ | return qe_invalid; | |
| 16093 | } | ||
| 16094 | |||
| 16095 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1170424 times.
|
1170424 | if(!p_getc(&(temp_mapscr->warparrivaly),f)) |
| 16096 | { | ||
| 16097 | ✗ | return qe_invalid; | |
| 16098 | } | ||
| 16099 | |||
| 16100 |
2/2✓ Branch 0 taken 4681696 times.
✓ Branch 1 taken 1170424 times.
|
5852120 | for(int32_t k=0; k<4; k++) |
| 16101 | { | ||
| 16102 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4681696 times.
|
4681696 | if(!p_getc(&(temp_mapscr->path[k]),f)) |
| 16103 | { | ||
| 16104 | ✗ | return qe_invalid; | |
| 16105 | } | ||
| 16106 | 4681696 | } | |
| 16107 | |||
| 16108 |
1/2✓ Branch 0 taken 1170424 times.
✗ Branch 1 not taken.
|
1170424 | if(!p_getc(&(temp_mapscr->sidewarpscr[0]),f)) |
| 16109 | { | ||
| 16110 | ✗ | return qe_invalid; | |
| 16111 | } | ||
| 16112 | |||
| 16113 |
3/6✓ Branch 0 taken 520072 times.
✓ Branch 1 taken 650352 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 520072 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 16114 | { | ||
| 16115 |
2/2✓ Branch 0 taken 650352 times.
✓ Branch 1 taken 1951056 times.
|
2601408 | for(int32_t i=1; i<4; i++) |
| 16116 | { | ||
| 16117 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1951056 times.
|
1951056 | if(!p_getc(&(temp_mapscr->sidewarpscr[i]),f)) |
| 16118 | { | ||
| 16119 | ✗ | return qe_invalid; | |
| 16120 | } | ||
| 16121 | 1951056 | } | |
| 16122 | 650352 | } | |
| 16123 | else | ||
| 16124 | { | ||
| 16125 | 520072 | temp_mapscr->sidewarpscr[1]=0; | |
| 16126 | 520072 | temp_mapscr->sidewarpscr[2]=0; | |
| 16127 | 520072 | temp_mapscr->sidewarpscr[3]=0; | |
| 16128 | } | ||
| 16129 | |||
| 16130 |
2/2✓ Branch 0 taken 520072 times.
✓ Branch 1 taken 650352 times.
|
1170424 | if(version <= 11) |
| 16131 | { | ||
| 16132 |
1/2✓ Branch 0 taken 520072 times.
✗ Branch 1 not taken.
|
520072 | if(!p_getc(&(tempbyte),f)) |
| 16133 | { | ||
| 16134 | ✗ | return qe_invalid; | |
| 16135 | } | ||
| 16136 | |||
| 16137 | 520072 | temp_mapscr->sidewarpdmap[0]=(word)tempbyte; | |
| 16138 | |||
| 16139 |
2/6✓ Branch 0 taken 520072 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 520072 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
520072 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 16140 | { | ||
| 16141 | ✗ | for(int32_t i=1; i<4; i++) | |
| 16142 | { | ||
| 16143 | ✗ | if(!p_getc(&(tempbyte),f)) | |
| 16144 | { | ||
| 16145 | ✗ | return qe_invalid; | |
| 16146 | } | ||
| 16147 | |||
| 16148 | ✗ | temp_mapscr->sidewarpdmap[i]=(word)tempbyte; | |
| 16149 | ✗ | } | |
| 16150 | ✗ | } | |
| 16151 | else | ||
| 16152 | { | ||
| 16153 | 520072 | temp_mapscr->sidewarpdmap[1]=0; | |
| 16154 | 520072 | temp_mapscr->sidewarpdmap[2]=0; | |
| 16155 | 520072 | temp_mapscr->sidewarpdmap[3]=0; | |
| 16156 | } | ||
| 16157 | 520072 | } | |
| 16158 | else | ||
| 16159 | { | ||
| 16160 |
2/2✓ Branch 0 taken 2601408 times.
✓ Branch 1 taken 650352 times.
|
3251760 | for(int32_t i=0; i<4; i++) |
| 16161 | { | ||
| 16162 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2601408 times.
|
2601408 | if(!p_igetw(&(temp_mapscr->sidewarpdmap[i]),f)) |
| 16163 | { | ||
| 16164 | ✗ | return qe_invalid; | |
| 16165 | } | ||
| 16166 | 2601408 | } | |
| 16167 | } | ||
| 16168 | |||
| 16169 |
3/6✓ Branch 0 taken 520072 times.
✓ Branch 1 taken 650352 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 520072 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 16170 | { | ||
| 16171 |
1/2✓ Branch 0 taken 650352 times.
✗ Branch 1 not taken.
|
650352 | if(!p_getc(&(temp_mapscr->sidewarpindex),f)) |
| 16172 | { | ||
| 16173 | ✗ | return qe_invalid; | |
| 16174 | } | ||
| 16175 | 650352 | } | |
| 16176 | 520072 | else temp_mapscr->sidewarpindex = 0; | |
| 16177 | |||
| 16178 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1170424 times.
|
1170424 | if(!p_igetw(&(temp_mapscr->undercombo),f)) |
| 16179 | { | ||
| 16180 | ✗ | return qe_invalid; | |
| 16181 | } | ||
| 16182 | |||
| 16183 | 1170424 | byte old_combo_page = 0; | |
| 16184 |
2/2✓ Branch 0 taken 1145528 times.
✓ Branch 1 taken 24896 times.
|
1170424 | if(Header->zelda_version < 0x193) |
| 16185 | { | ||
| 16186 |
1/2✓ Branch 0 taken 24896 times.
✗ Branch 1 not taken.
|
24896 | if (!p_getc(&old_combo_page, f)) |
| 16187 | { | ||
| 16188 | ✗ | return qe_invalid; | |
| 16189 | } | ||
| 16190 | |||
| 16191 |
2/2✓ Branch 0 taken 272 times.
✓ Branch 1 taken 24624 times.
|
24896 | if (!should_skip) |
| 16192 | { | ||
| 16193 | 24624 | old_combo_pages[scrind] = old_combo_page; | |
| 16194 | 24624 | } | |
| 16195 | 24896 | } | |
| 16196 | |||
| 16197 |
1/2✓ Branch 0 taken 1170424 times.
✗ Branch 1 not taken.
|
1170424 | if(!p_getc(&(temp_mapscr->undercset),f)) //recalculated for older quests |
| 16198 | { | ||
| 16199 | ✗ | return qe_invalid; | |
| 16200 | } | ||
| 16201 | |||
| 16202 |
1/2✓ Branch 0 taken 1170424 times.
✗ Branch 1 not taken.
|
1170424 | if(!p_igetw(&(temp_mapscr->catchall),f)) |
| 16203 | { | ||
| 16204 | ✗ | return qe_invalid; | |
| 16205 | } | ||
| 16206 | |||
| 16207 |
1/2✓ Branch 0 taken 1170424 times.
✗ Branch 1 not taken.
|
1170424 | if(!p_getc(&(temp_mapscr->flags),f)) |
| 16208 | { | ||
| 16209 | ✗ | return qe_invalid; | |
| 16210 | } | ||
| 16211 | |||
| 16212 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1170424 times.
|
1170424 | if(!p_getc(&(temp_mapscr->flags2),f)) |
| 16213 | { | ||
| 16214 | ✗ | return qe_invalid; | |
| 16215 | } | ||
| 16216 | |||
| 16217 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1170424 times.
|
1170424 | if(!p_getc(&(temp_mapscr->flags3),f)) |
| 16218 | { | ||
| 16219 | ✗ | return qe_invalid; | |
| 16220 | } | ||
| 16221 | |||
| 16222 |
3/6✓ Branch 0 taken 520072 times.
✓ Branch 1 taken 650352 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 520072 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>1))) |
| 16223 | //if (version>2) | ||
| 16224 | { | ||
| 16225 |
1/2✓ Branch 0 taken 650352 times.
✗ Branch 1 not taken.
|
650352 | if(!p_getc(&(temp_mapscr->flags4),f)) |
| 16226 | { | ||
| 16227 | ✗ | return qe_invalid; | |
| 16228 | } | ||
| 16229 | 650352 | } | |
| 16230 | |||
| 16231 |
3/6✓ Branch 0 taken 520072 times.
✓ Branch 1 taken 650352 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 520072 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 16232 | { | ||
| 16233 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650352 times.
|
650352 | if(!p_getc(&(temp_mapscr->flags5),f)) |
| 16234 | { | ||
| 16235 | ✗ | return qe_invalid; | |
| 16236 | } | ||
| 16237 | |||
| 16238 |
1/2✓ Branch 0 taken 650352 times.
✗ Branch 1 not taken.
|
650352 | if(!p_igetw(&wpadding,f)) |
| 16239 | ✗ | return qe_invalid; | |
| 16240 | 650352 | temp_mapscr->noreset = wpadding | mLIGHTBEAM | mTMPNORET | mVISITED; | |
| 16241 |
1/2✓ Branch 0 taken 650352 times.
✗ Branch 1 not taken.
|
650352 | if(!p_igetw(&wpadding,f)) |
| 16242 | ✗ | return qe_invalid; | |
| 16243 | 1300704 | temp_mapscr->nocarry = wpadding | mLIGHTBEAM | mTMPNORET | mVISITED | | |
| 16244 | 650352 | mDOOR_UP | mDOOR_DOWN | mDOOR_LEFT | mDOOR_RIGHT | mNEVERRET | mNO_ENEMIES_RETURN; | |
| 16245 | |||
| 16246 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650352 times.
|
650352 | if(temp_mapscr->flags5&32) |
| 16247 | { | ||
| 16248 | ✗ | temp_mapscr->flags5 &= ~32; | |
| 16249 | ✗ | temp_mapscr->noreset |= 48; | |
| 16250 | ✗ | } | |
| 16251 | |||
| 16252 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650352 times.
|
650352 | if(version<8) |
| 16253 | { | ||
| 16254 | ✗ | if(temp_mapscr->noreset&1) | |
| 16255 | { | ||
| 16256 | ✗ | temp_mapscr->noreset|=8192; | |
| 16257 | ✗ | } | |
| 16258 | |||
| 16259 | ✗ | if(temp_mapscr->nocarry&1) | |
| 16260 | { | ||
| 16261 | ✗ | temp_mapscr->nocarry|=8192; | |
| 16262 | ✗ | temp_mapscr->nocarry&=~1; | |
| 16263 | ✗ | } | |
| 16264 | ✗ | } | |
| 16265 | 650352 | } | |
| 16266 | else | ||
| 16267 | { | ||
| 16268 | 520072 | temp_mapscr->flags5 = 0; | |
| 16269 | 520072 | temp_mapscr->noreset = mLIGHTBEAM | mTMPNORET | mVISITED; | |
| 16270 | 520072 | temp_mapscr->nocarry = mLIGHTBEAM | mTMPNORET | mVISITED | | |
| 16271 | mDOOR_UP | mDOOR_DOWN | mDOOR_LEFT | mDOOR_RIGHT | mNEVERRET | mNO_ENEMIES_RETURN; | ||
| 16272 | } | ||
| 16273 | |||
| 16274 |
3/6✓ Branch 0 taken 520072 times.
✓ Branch 1 taken 650352 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 520072 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>9))) |
| 16275 | { | ||
| 16276 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650352 times.
|
650352 | if(!p_getc(&(temp_mapscr->flags6),f)) |
| 16277 | { | ||
| 16278 | ✗ | return qe_invalid; | |
| 16279 | } | ||
| 16280 | 650352 | } | |
| 16281 | |||
| 16282 |
2/2✓ Branch 0 taken 650352 times.
✓ Branch 1 taken 520072 times.
|
1170424 | if(version>5) |
| 16283 | { | ||
| 16284 |
1/2✓ Branch 0 taken 650352 times.
✗ Branch 1 not taken.
|
650352 | if(!p_getc(&(temp_mapscr->flags7),f)) |
| 16285 | { | ||
| 16286 | ✗ | return qe_invalid; | |
| 16287 | } | ||
| 16288 | |||
| 16289 |
1/2✓ Branch 0 taken 650352 times.
✗ Branch 1 not taken.
|
650352 | if(!p_getc(&(temp_mapscr->flags8),f)) |
| 16290 | { | ||
| 16291 | ✗ | return qe_invalid; | |
| 16292 | } | ||
| 16293 | |||
| 16294 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650352 times.
|
650352 | if(!p_getc(&(temp_mapscr->flags9),f)) |
| 16295 | { | ||
| 16296 | ✗ | return qe_invalid; | |
| 16297 | } | ||
| 16298 | |||
| 16299 |
1/2✓ Branch 0 taken 650352 times.
✗ Branch 1 not taken.
|
650352 | if(!p_getc(&(temp_mapscr->flags10),f)) |
| 16300 | { | ||
| 16301 | ✗ | return qe_invalid; | |
| 16302 | } | ||
| 16303 | |||
| 16304 |
1/2✓ Branch 0 taken 650352 times.
✗ Branch 1 not taken.
|
650352 | if(!p_getc(&(temp_mapscr->csensitive),f)) |
| 16305 | { | ||
| 16306 | ✗ | return qe_invalid; | |
| 16307 | } | ||
| 16308 | 650352 | } | |
| 16309 | else | ||
| 16310 | { | ||
| 16311 | 520072 | temp_mapscr->csensitive=1; | |
| 16312 | } | ||
| 16313 | |||
| 16314 |
2/2✓ Branch 0 taken 520072 times.
✓ Branch 1 taken 650352 times.
|
1170424 | if(version<14) // August 2007: screen SFX added |
| 16315 | { | ||
| 16316 |
2/2✓ Branch 0 taken 519078 times.
✓ Branch 1 taken 994 times.
|
520072 | if(temp_mapscr->flags&8) //fROAR |
| 16317 | { | ||
| 16318 | 994 | temp_mapscr->bosssfx= | |
| 16319 |
2/2✓ Branch 0 taken 141 times.
✓ Branch 1 taken 853 times.
|
994 | (temp_mapscr->flags3&2) ? WAV_DODONGO : // fDODONGO |
| 16320 | 853 | (temp_mapscr->flags2&32) ? WAV_VADER : // fVADER | |
| 16321 | WAV_ROAR; | ||
| 16322 | 994 | } | |
| 16323 | |||
| 16324 |
2/2✓ Branch 0 taken 170 times.
✓ Branch 1 taken 519902 times.
|
520072 | if(temp_mapscr->flags&128) //fSEA_SFX |
| 16325 | { | ||
| 16326 | 170 | temp_mapscr->oceansfx=WAV_SEA; | |
| 16327 | 170 | } | |
| 16328 | |||
| 16329 | 520072 | temp_mapscr->secretsfx = (temp_mapscr->flags3&64) //fNOSECRETSOUND | |
| 16330 | ? 0 : WAV_SECRET; | ||
| 16331 | |||
| 16332 | 520072 | temp_mapscr->flags3 &= ~66; //64|2 | |
| 16333 | 520072 | temp_mapscr->flags2 &= ~32; | |
| 16334 | 520072 | temp_mapscr->flags &= ~136; // 128|8 | |
| 16335 | 520072 | } | |
| 16336 | else | ||
| 16337 | { | ||
| 16338 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650352 times.
|
650352 | if(!p_getc(&(temp_mapscr->oceansfx),f)) |
| 16339 | { | ||
| 16340 | ✗ | return qe_invalid; | |
| 16341 | } | ||
| 16342 | |||
| 16343 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650352 times.
|
650352 | if(!p_getc(&(temp_mapscr->bosssfx),f)) |
| 16344 | { | ||
| 16345 | ✗ | return qe_invalid; | |
| 16346 | } | ||
| 16347 | |||
| 16348 |
1/2✓ Branch 0 taken 650352 times.
✗ Branch 1 not taken.
|
650352 | if(!p_getc(&(temp_mapscr->secretsfx),f)) |
| 16349 | { | ||
| 16350 | ✗ | return qe_invalid; | |
| 16351 | } | ||
| 16352 | } | ||
| 16353 | |||
| 16354 |
2/2✓ Branch 0 taken 520072 times.
✓ Branch 1 taken 650352 times.
|
1170424 | if(version<15) // October 2007: another SFX |
| 16355 | { | ||
| 16356 | 520072 | temp_mapscr->holdupsfx=WAV_PICKUP; | |
| 16357 | 520072 | } | |
| 16358 | else | ||
| 16359 | { | ||
| 16360 |
1/2✓ Branch 0 taken 650352 times.
✗ Branch 1 not taken.
|
650352 | if(!p_getc(&(temp_mapscr->holdupsfx),f)) |
| 16361 | { | ||
| 16362 | ✗ | return qe_invalid; | |
| 16363 | } | ||
| 16364 | } | ||
| 16365 | |||
| 16366 | |||
| 16367 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1145528 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>97))) |
| 16368 | { | ||
| 16369 |
2/2✓ Branch 0 taken 6889488 times.
✓ Branch 1 taken 1148248 times.
|
8037736 | for(int32_t k=0; k<6; k++) |
| 16370 | { | ||
| 16371 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6889488 times.
|
6889488 | if(!p_getc(&(temp_mapscr->layermap[k]),f)) |
| 16372 | { | ||
| 16373 | ✗ | return qe_invalid; | |
| 16374 | } | ||
| 16375 | 6889488 | } | |
| 16376 | |||
| 16377 |
2/2✓ Branch 0 taken 1148248 times.
✓ Branch 1 taken 6889488 times.
|
8037736 | for(int32_t k=0; k<6; k++) |
| 16378 | { | ||
| 16379 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6889488 times.
|
6889488 | if(!p_getc(&(temp_mapscr->layerscreen[k]),f)) |
| 16380 | { | ||
| 16381 | ✗ | return qe_invalid; | |
| 16382 | } | ||
| 16383 | 6889488 | } | |
| 16384 | 1148248 | } | |
| 16385 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 22176 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
22176 | else if((Header->zelda_version == 0x192)&&(Header->build>23)&&(Header->build<98)) |
| 16386 | { | ||
| 16387 | ✗ | if(!p_getc(&(temp_mapscr->layermap[2]),f)) | |
| 16388 | { | ||
| 16389 | ✗ | return qe_invalid; | |
| 16390 | } | ||
| 16391 | |||
| 16392 | ✗ | if(!p_getc(&(temp_mapscr->layerscreen[2]),f)) | |
| 16393 | { | ||
| 16394 | ✗ | return qe_invalid; | |
| 16395 | } | ||
| 16396 | |||
| 16397 | ✗ | if(!p_getc(&(temp_mapscr->layermap[4]),f)) | |
| 16398 | { | ||
| 16399 | ✗ | return qe_invalid; | |
| 16400 | } | ||
| 16401 | |||
| 16402 | ✗ | if(!p_getc(&(temp_mapscr->layerscreen[4]),f)) | |
| 16403 | |||
| 16404 | { | ||
| 16405 | ✗ | return qe_invalid; | |
| 16406 | } | ||
| 16407 | ✗ | } | |
| 16408 | |||
| 16409 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1167704 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1170424 | if((Header->zelda_version == 0x192)&&(Header->build>149)) |
| 16410 | { | ||
| 16411 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16412 | { | ||
| 16413 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerxsize |
| 16414 | { | ||
| 16415 | ✗ | return qe_invalid; | |
| 16416 | } | ||
| 16417 | 16320 | } | |
| 16418 | |||
| 16419 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16420 | { | ||
| 16421 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerxspeed |
| 16422 | { | ||
| 16423 | ✗ | return qe_invalid; | |
| 16424 | } | ||
| 16425 | 16320 | } | |
| 16426 | |||
| 16427 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16428 | { | ||
| 16429 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerxdelay |
| 16430 | { | ||
| 16431 | ✗ | return qe_invalid; | |
| 16432 | } | ||
| 16433 | 16320 | } | |
| 16434 | |||
| 16435 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16436 | { | ||
| 16437 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerysize |
| 16438 | { | ||
| 16439 | ✗ | return qe_invalid; | |
| 16440 | } | ||
| 16441 | 16320 | } | |
| 16442 | |||
| 16443 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16444 | { | ||
| 16445 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layeryspeed |
| 16446 | { | ||
| 16447 | ✗ | return qe_invalid; | |
| 16448 | } | ||
| 16449 | 16320 | } | |
| 16450 | |||
| 16451 |
2/2✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 16320 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16452 | { | ||
| 16453 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerydelay |
| 16454 | { | ||
| 16455 | ✗ | return qe_invalid; | |
| 16456 | } | ||
| 16457 | 16320 | } | |
| 16458 | 2720 | } | |
| 16459 | |||
| 16460 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1145528 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>149))) |
| 16461 | { | ||
| 16462 |
2/2✓ Branch 0 taken 6889488 times.
✓ Branch 1 taken 1148248 times.
|
8037736 | for(int32_t k=0; k<6; k++) |
| 16463 | { | ||
| 16464 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6889488 times.
|
6889488 | if(!p_getc(&(temp_mapscr->layeropacity[k]),f)) |
| 16465 | { | ||
| 16466 | ✗ | return qe_invalid; | |
| 16467 | } | ||
| 16468 | 6889488 | } | |
| 16469 | 1148248 | } | |
| 16470 | |||
| 16471 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1145528 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>153))) |
| 16472 | { | ||
| 16473 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1145528 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1148248 | if((Header->zelda_version == 0x192)&&(Header->build>153)) |
| 16474 | { | ||
| 16475 |
1/2✓ Branch 0 taken 2720 times.
✗ Branch 1 not taken.
|
2720 | if(!p_getc(&padding,f)) |
| 16476 | { | ||
| 16477 | ✗ | return qe_invalid; | |
| 16478 | } | ||
| 16479 | 2720 | } | |
| 16480 | |||
| 16481 |
1/2✓ Branch 0 taken 1148248 times.
✗ Branch 1 not taken.
|
1148248 | if(!p_igetw(&(temp_mapscr->timedwarptics),f)) |
| 16482 | { | ||
| 16483 | ✗ | return qe_invalid; | |
| 16484 | } | ||
| 16485 | 1148248 | } | |
| 16486 | |||
| 16487 |
5/6✓ Branch 0 taken 1148248 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1145528 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1170424 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<24))) |
| 16488 | { | ||
| 16489 | 22176 | extras=15; | |
| 16490 | 22176 | } | |
| 16491 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1145528 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1148248 | else if(((Header->zelda_version == 0x192)&&(Header->build<98))) |
| 16492 | { | ||
| 16493 | ✗ | extras=11; | |
| 16494 | ✗ | } | |
| 16495 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1145528 times.
✓ Branch 2 taken 2720 times.
✗ Branch 3 not taken.
|
1148248 | else if((Header->zelda_version == 0x192)&&(Header->build<150)) |
| 16496 | { | ||
| 16497 | ✗ | extras=32; | |
| 16498 | ✗ | } | |
| 16499 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1145528 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1148248 | else if((Header->zelda_version == 0x192)&&(Header->build<154)) |
| 16500 | { | ||
| 16501 | ✗ | extras=64; | |
| 16502 | ✗ | } | |
| 16503 |
2/2✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1145528 times.
|
1148248 | else if(Header->zelda_version < 0x193) |
| 16504 | { | ||
| 16505 | 2720 | extras=62; | |
| 16506 | 2720 | } | |
| 16507 | else | ||
| 16508 | |||
| 16509 | { | ||
| 16510 | 1145528 | extras=0; | |
| 16511 | } | ||
| 16512 | |||
| 16513 |
2/2✓ Branch 0 taken 501280 times.
✓ Branch 1 taken 1170424 times.
|
1671704 | for(int32_t k=0; k<extras; k++) |
| 16514 | { | ||
| 16515 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 501280 times.
|
501280 | if(!p_getc(&tempbyte,f)) //extra[k] |
| 16516 | { | ||
| 16517 | ✗ | return qe_invalid; | |
| 16518 | } | ||
| 16519 | 501280 | } | |
| 16520 | |||
| 16521 |
3/6✓ Branch 0 taken 520072 times.
✓ Branch 1 taken 650352 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 520072 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>2))) |
| 16522 | //if (version>3) | ||
| 16523 | { | ||
| 16524 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650352 times.
|
650352 | if(!p_getc(&(temp_mapscr->nextmap),f)) |
| 16525 | { | ||
| 16526 | ✗ | return qe_invalid; | |
| 16527 | } | ||
| 16528 | |||
| 16529 |
1/2✓ Branch 0 taken 650352 times.
✗ Branch 1 not taken.
|
650352 | if(!p_getc(&(temp_mapscr->nextscr),f)) |
| 16530 | { | ||
| 16531 | ✗ | return qe_invalid; | |
| 16532 | } | ||
| 16533 | 650352 | } | |
| 16534 | else | ||
| 16535 | { | ||
| 16536 | 520072 | temp_mapscr->nextmap=0; | |
| 16537 | 520072 | temp_mapscr->nextscr=0; | |
| 16538 | } | ||
| 16539 | |||
| 16540 |
5/6✓ Branch 0 taken 1148248 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1145528 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1170424 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 16541 | { | ||
| 16542 | 22176 | secretcombos=20; | |
| 16543 | 22176 | } | |
| 16544 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1145528 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1148248 | else if((Header->zelda_version == 0x192)&&(Header->build<154)) |
| 16545 | { | ||
| 16546 | ✗ | secretcombos=256; | |
| 16547 | ✗ | } | |
| 16548 | else | ||
| 16549 | { | ||
| 16550 | 1148248 | secretcombos=128; | |
| 16551 | } | ||
| 16552 | |||
| 16553 |
5/6✓ Branch 0 taken 1148248 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1145528 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1170424 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 16554 | { | ||
| 16555 |
2/2✓ Branch 0 taken 443520 times.
✓ Branch 1 taken 22176 times.
|
465696 | for(int32_t k=0; k<secretcombos; k++) |
| 16556 | { | ||
| 16557 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 443520 times.
|
443520 | if(!p_getc(&tempbyte,f)) |
| 16558 | { | ||
| 16559 | ✗ | return qe_invalid; | |
| 16560 | } | ||
| 16561 | |||
| 16562 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 443520 times.
|
443520 | if(k<128) |
| 16563 | { | ||
| 16564 | 443520 | temp_mapscr->secretcombo[k]=tempbyte; | |
| 16565 | 443520 | } | |
| 16566 | 443520 | } | |
| 16567 | 22176 | } | |
| 16568 | else | ||
| 16569 | { | ||
| 16570 |
2/2✓ Branch 0 taken 146975744 times.
✓ Branch 1 taken 1148248 times.
|
148123992 | for(int32_t k=0; k<128; k++) |
| 16571 | { | ||
| 16572 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 146975744 times.
|
146975744 | if(!p_igetw(&(temp_mapscr->secretcombo[k]),f)) |
| 16573 | { | ||
| 16574 | ✗ | return qe_invalid; | |
| 16575 | } | ||
| 16576 | |||
| 16577 | 146975744 | } | |
| 16578 | } | ||
| 16579 | |||
| 16580 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1145528 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>153))) |
| 16581 | { | ||
| 16582 |
2/2✓ Branch 0 taken 146975744 times.
✓ Branch 1 taken 1148248 times.
|
148123992 | for(int32_t k=0; k<128; k++) |
| 16583 | { | ||
| 16584 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 146975744 times.
|
146975744 | if(!p_getc(&(temp_mapscr->secretcset[k]),f)) |
| 16585 | { | ||
| 16586 | ✗ | return qe_invalid; | |
| 16587 | } | ||
| 16588 | 146975744 | } | |
| 16589 | |||
| 16590 |
2/2✓ Branch 0 taken 146975744 times.
✓ Branch 1 taken 1148248 times.
|
148123992 | for(int32_t k=0; k<128; k++) |
| 16591 | { | ||
| 16592 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 146975744 times.
|
146975744 | if(!p_getc(&(temp_mapscr->secretflag[k]),f)) |
| 16593 | { | ||
| 16594 | ✗ | return qe_invalid; | |
| 16595 | } | ||
| 16596 | 146975744 | } | |
| 16597 | 1148248 | } | |
| 16598 | |||
| 16599 |
4/6✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1167704 times.
✓ Branch 2 taken 2720 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version == 0x192)&&(Header->build>97)&&(Header->build<154)) |
| 16600 | { | ||
| 16601 | ✗ | if(!p_getc(&padding,f)) | |
| 16602 | { | ||
| 16603 | ✗ | return qe_invalid; | |
| 16604 | } | ||
| 16605 | ✗ | } | |
| 16606 | |||
| 16607 |
2/2✓ Branch 0 taken 205994624 times.
✓ Branch 1 taken 1170424 times.
|
207165048 | for(int32_t k=0; k<176; k++) |
| 16608 | { | ||
| 16609 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 205994624 times.
|
205994624 | if(!p_igetw(&(temp_mapscr->data[k]),f)) |
| 16610 | { | ||
| 16611 | ✗ | return qe_invalid; | |
| 16612 | } | ||
| 16613 | 205994624 | } | |
| 16614 | |||
| 16615 |
4/6✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1167704 times.
✓ Branch 2 taken 2720 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version == 0x192)&&(Header->build>20)&&(Header->build<24)) |
| 16616 | { | ||
| 16617 | ✗ | if(!p_getc(&padding,f)) | |
| 16618 | { | ||
| 16619 | ✗ | return qe_invalid; | |
| 16620 | } | ||
| 16621 | |||
| 16622 | ✗ | if(!p_getc(&padding,f)) | |
| 16623 | { | ||
| 16624 | ✗ | return qe_invalid; | |
| 16625 | } | ||
| 16626 | ✗ | } | |
| 16627 | |||
| 16628 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1145528 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>20))) |
| 16629 | { | ||
| 16630 |
2/2✓ Branch 0 taken 202091648 times.
✓ Branch 1 taken 1148248 times.
|
203239896 | for(int32_t k=0; k<176; k++) |
| 16631 | { | ||
| 16632 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 202091648 times.
|
202091648 | if(!p_getc(&(temp_mapscr->sflag[k]),f)) |
| 16633 | { | ||
| 16634 | ✗ | return qe_invalid; | |
| 16635 | } | ||
| 16636 | |||
| 16637 |
3/4✓ Branch 0 taken 478720 times.
✓ Branch 1 taken 201612928 times.
✓ Branch 2 taken 478720 times.
✗ Branch 3 not taken.
|
202091648 | if((Header->zelda_version == 0x192)&&(Header->build<24)) |
| 16638 | { | ||
| 16639 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 16640 | { | ||
| 16641 | ✗ | return qe_invalid; | |
| 16642 | } | ||
| 16643 | |||
| 16644 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 16645 | { | ||
| 16646 | ✗ | return qe_invalid; | |
| 16647 | } | ||
| 16648 | |||
| 16649 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 16650 | { | ||
| 16651 | ✗ | return qe_invalid; | |
| 16652 | } | ||
| 16653 | ✗ | } | |
| 16654 | 202091648 | } | |
| 16655 | 1148248 | } | |
| 16656 | |||
| 16657 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1145528 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1170424 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>97))) |
| 16658 | { | ||
| 16659 |
2/2✓ Branch 0 taken 1148248 times.
✓ Branch 1 taken 202091648 times.
|
203239896 | for(int32_t k=0; k<176; k++) |
| 16660 | { | ||
| 16661 | |||
| 16662 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 202091648 times.
|
202091648 | if(!p_getc(&(temp_mapscr->cset[k]),f)) |
| 16663 | { | ||
| 16664 | ✗ | return qe_invalid; | |
| 16665 | } | ||
| 16666 | 202091648 | } | |
| 16667 | 1148248 | } | |
| 16668 | |||
| 16669 |
5/6✓ Branch 0 taken 1148248 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1145528 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1170424 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 16670 | { | ||
| 16671 | 22176 | temp_mapscr->undercset=(temp_mapscr->undercombo>>8)&7; | |
| 16672 | 22176 | temp_mapscr->undercombo=(temp_mapscr->undercombo&0xFF)+(old_combo_page<<8); | |
| 16673 | 22176 | } | |
| 16674 | |||
| 16675 |
5/6✓ Branch 0 taken 1148248 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1145528 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1170424 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 16676 | { | ||
| 16677 | 22176 | temp_mapscr->secretcombo[sSBOMB]=temp_mapscr->secretcombo[sBOMB]; | |
| 16678 | 22176 | temp_mapscr->secretcombo[sRCANDLE]=temp_mapscr->secretcombo[sBCANDLE]; | |
| 16679 | 22176 | temp_mapscr->secretcombo[sWANDFIRE]=temp_mapscr->secretcombo[sBCANDLE]; | |
| 16680 | 22176 | temp_mapscr->secretcombo[sDIVINEFIRE]=temp_mapscr->secretcombo[sBCANDLE]; | |
| 16681 | 22176 | temp_mapscr->secretcombo[sSARROW]=temp_mapscr->secretcombo[sARROW]; | |
| 16682 | 22176 | temp_mapscr->secretcombo[sGARROW]=temp_mapscr->secretcombo[sARROW]; | |
| 16683 | 22176 | } | |
| 16684 | |||
| 16685 |
5/6✓ Branch 0 taken 1148248 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1145528 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1170424 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 16686 | { | ||
| 16687 |
2/2✓ Branch 0 taken 3902976 times.
✓ Branch 1 taken 22176 times.
|
3925152 | for(int32_t k=0; k<176; k++) |
| 16688 | { | ||
| 16689 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3902976 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3902976 | if((Header->zelda_version == 0x192)&&(Header->build>149)) |
| 16690 | { | ||
| 16691 | ✗ | if((Header->zelda_version == 0x192)&&(Header->build!=153)) | |
| 16692 | { | ||
| 16693 | ✗ | temp_mapscr->cset[k]=((temp_mapscr->data[k]>>8)&7); | |
| 16694 | ✗ | } | |
| 16695 | ✗ | } | |
| 16696 | else | ||
| 16697 | { | ||
| 16698 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3902976 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3902976 | if((Header->zelda_version < 0x192)|| |
| 16699 | ✗ | ((Header->zelda_version == 0x192)&&(Header->build<21))) | |
| 16700 | { | ||
| 16701 | 3902976 | temp_mapscr->sflag[k]=(temp_mapscr->data[k]>>11); | |
| 16702 | 3902976 | } | |
| 16703 | |||
| 16704 | 3902976 | temp_mapscr->cset[k]=((temp_mapscr->data[k]>>8)&7); | |
| 16705 | } | ||
| 16706 | |||
| 16707 | 3902976 | temp_mapscr->data[k]=(temp_mapscr->data[k]&0xFF)+(old_combo_page<<8); | |
| 16708 | 3902976 | } | |
| 16709 | 22176 | } | |
| 16710 | |||
| 16711 | /*if(version>12) | ||
| 16712 | { | ||
| 16713 | if(!p_getc(&(temp_mapscr->scrWidth),f)) | ||
| 16714 | { | ||
| 16715 | return qe_invalid; | ||
| 16716 | } | ||
| 16717 | if(!p_getc(&(temp_mapscr->scrHeight),f)) | ||
| 16718 | { | ||
| 16719 | return qe_invalid; | ||
| 16720 | } | ||
| 16721 | }*/ | ||
| 16722 | |||
| 16723 |
2/2✓ Branch 0 taken 650352 times.
✓ Branch 1 taken 520072 times.
|
1170424 | if(version>4) |
| 16724 | { | ||
| 16725 | int16_t m; | ||
| 16726 |
1/2✓ Branch 0 taken 650352 times.
✗ Branch 1 not taken.
|
650352 | if(!p_igetw(&m, f)) |
| 16727 | ✗ | return qe_invalid; | |
| 16728 |
2/2✓ Branch 0 taken 644307 times.
✓ Branch 1 taken 6045 times.
|
650352 | if (m <= 0) |
| 16729 | 644307 | temp_mapscr->music = vbound(m, 0, -1); | |
| 16730 |
1/2✓ Branch 0 taken 6045 times.
✗ Branch 1 not taken.
|
6045 | else if (!keep_music) // can't safely convert without modifying quest_music, so just use -1 |
| 16731 | ✗ | temp_mapscr->music = -1; | |
| 16732 | 6045 | else temp_mapscr->music = find_or_make_midi_music(convert_from_old_midi_id(m + (MIDIOFFSET_MAPSCR - MIDIOFFSET_ZSCRIPT),true)); | |
| 16733 | 650352 | } | |
| 16734 | else | ||
| 16735 | { | ||
| 16736 | 520072 | temp_mapscr->music = -1; | |
| 16737 | } | ||
| 16738 | |||
| 16739 |
2/2✓ Branch 0 taken 650352 times.
✓ Branch 1 taken 520072 times.
|
1170424 | if(version>=17) |
| 16740 | { | ||
| 16741 |
1/2✓ Branch 0 taken 650352 times.
✗ Branch 1 not taken.
|
650352 | if(!p_getc(&(temp_mapscr->lens_layer),f)) |
| 16742 | { | ||
| 16743 | ✗ | return qe_invalid; | |
| 16744 | } | ||
| 16745 | 650352 | } | |
| 16746 | else | ||
| 16747 | { | ||
| 16748 | 520072 | temp_mapscr->lens_layer = llNORMAL; | |
| 16749 | } | ||
| 16750 | |||
| 16751 |
2/2✓ Branch 0 taken 520072 times.
✓ Branch 1 taken 650352 times.
|
1170424 | if(version>6) |
| 16752 | { | ||
| 16753 | dword bits; | ||
| 16754 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650352 times.
|
650352 | if(!p_igetl(&bits,f)) |
| 16755 | { | ||
| 16756 | ✗ | return qe_invalid; | |
| 16757 | } | ||
| 16758 | |||
| 16759 | int32_t m; | ||
| 16760 | float tempfloat; | ||
| 16761 | word tempw; | ||
| 16762 | 650352 | temp_mapscr->ffcCountMarkDirty(); | |
| 16763 | 650352 | temp_mapscr->ffcs.clear(); | |
| 16764 | 650352 | temp_mapscr->resizeFFC(std::bit_width(bits)); | |
| 16765 |
2/2✓ Branch 0 taken 650352 times.
✓ Branch 1 taken 20811264 times.
|
21461616 | for(m=0; m<32; m++) |
| 16766 | { | ||
| 16767 |
2/2✓ Branch 0 taken 20536512 times.
✓ Branch 1 taken 274752 times.
|
20811264 | if((bits>>m)&1) |
| 16768 | { | ||
| 16769 | 274752 | ffcdata& tempffc = temp_mapscr->ffcs[m]; | |
| 16770 |
1/2✓ Branch 0 taken 274752 times.
✗ Branch 1 not taken.
|
274752 | if(!p_igetw(&tempw,f)) |
| 16771 | { | ||
| 16772 | ✗ | return qe_invalid; | |
| 16773 | } | ||
| 16774 | 274752 | tempffc.data = tempw; | |
| 16775 | |||
| 16776 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_getc(&(tempffc.cset),f)) |
| 16777 | { | ||
| 16778 | ✗ | return qe_invalid; | |
| 16779 | } | ||
| 16780 | |||
| 16781 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_igetw(&(tempffc.delay),f)) |
| 16782 | { | ||
| 16783 | ✗ | return qe_invalid; | |
| 16784 | } | ||
| 16785 | |||
| 16786 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(version < 9) |
| 16787 | { | ||
| 16788 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16789 | { | ||
| 16790 | ✗ | return qe_invalid; | |
| 16791 | } | ||
| 16792 | |||
| 16793 | ✗ | tempffc.x=zslongToFix(int32_t(tempfloat*10000)); | |
| 16794 | |||
| 16795 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16796 | { | ||
| 16797 | ✗ | return qe_invalid; | |
| 16798 | } | ||
| 16799 | |||
| 16800 | ✗ | tempffc.y=zslongToFix(int32_t(tempfloat*10000)); | |
| 16801 | |||
| 16802 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16803 | { | ||
| 16804 | ✗ | return qe_invalid; | |
| 16805 | } | ||
| 16806 | |||
| 16807 | ✗ | tempffc.vx=zslongToFix(int32_t(tempfloat*10000)); | |
| 16808 | |||
| 16809 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16810 | { | ||
| 16811 | ✗ | return qe_invalid; | |
| 16812 | } | ||
| 16813 | |||
| 16814 | ✗ | tempffc.vy=zslongToFix(int32_t(tempfloat*10000)); | |
| 16815 | |||
| 16816 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16817 | { | ||
| 16818 | ✗ | return qe_invalid; | |
| 16819 | } | ||
| 16820 | |||
| 16821 | ✗ | tempffc.ax=zslongToFix(int32_t(tempfloat*10000)); | |
| 16822 | |||
| 16823 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16824 | { | ||
| 16825 | ✗ | return qe_invalid; | |
| 16826 | } | ||
| 16827 | |||
| 16828 | ✗ | tempffc.ay=zslongToFix(int32_t(tempfloat*10000)); | |
| 16829 | ✗ | } | |
| 16830 | else | ||
| 16831 | { | ||
| 16832 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_igetzf(&(tempffc.x),f)) |
| 16833 | { | ||
| 16834 | ✗ | return qe_invalid; | |
| 16835 | } | ||
| 16836 | |||
| 16837 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_igetzf(&(tempffc.y),f)) |
| 16838 | { | ||
| 16839 | ✗ | return qe_invalid; | |
| 16840 | } | ||
| 16841 | |||
| 16842 |
1/2✓ Branch 0 taken 274752 times.
✗ Branch 1 not taken.
|
274752 | if(!p_igetzf(&(tempffc.vx),f)) |
| 16843 | { | ||
| 16844 | ✗ | return qe_invalid; | |
| 16845 | } | ||
| 16846 | |||
| 16847 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_igetzf(&(tempffc.vy),f)) |
| 16848 | { | ||
| 16849 | ✗ | return qe_invalid; | |
| 16850 | } | ||
| 16851 | |||
| 16852 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_igetzf(&(tempffc.ax),f)) |
| 16853 | { | ||
| 16854 | ✗ | return qe_invalid; | |
| 16855 | } | ||
| 16856 | |||
| 16857 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_igetzf(&(tempffc.ay),f)) |
| 16858 | { | ||
| 16859 | ✗ | return qe_invalid; | |
| 16860 | } | ||
| 16861 | } | ||
| 16862 | |||
| 16863 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_getc(&(tempffc.link),f)) |
| 16864 | { | ||
| 16865 | ✗ | return qe_invalid; | |
| 16866 | } | ||
| 16867 | |||
| 16868 |
1/2✓ Branch 0 taken 274752 times.
✗ Branch 1 not taken.
|
274752 | if(version>7) |
| 16869 | { | ||
| 16870 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_getc(&tempbyte,f)) |
| 16871 | { | ||
| 16872 | ✗ | return qe_invalid; | |
| 16873 | } | ||
| 16874 | |||
| 16875 | 274752 | tempffc.hit_width = (tempbyte&0x3F)+1; | |
| 16876 | 274752 | tempffc.txsz = (tempbyte>>6)+1; | |
| 16877 | |||
| 16878 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_getc(&tempbyte,f)) |
| 16879 | { | ||
| 16880 | ✗ | return qe_invalid; | |
| 16881 | } | ||
| 16882 | |||
| 16883 | 274752 | tempffc.hit_height = (tempbyte&0x3F)+1; | |
| 16884 | 274752 | tempffc.tysz = (tempbyte>>6)+1; | |
| 16885 | |||
| 16886 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_igetl(&(tempffc.flags),f)) |
| 16887 | { | ||
| 16888 | ✗ | return qe_invalid; | |
| 16889 | } | ||
| 16890 | 274752 | } | |
| 16891 | else | ||
| 16892 | { | ||
| 16893 | ✗ | tempffc.hit_width=16; | |
| 16894 | ✗ | tempffc.hit_height=16; | |
| 16895 | ✗ | tempffc.txsz=1; | |
| 16896 | ✗ | tempffc.tysz=1; | |
| 16897 | ✗ | tempffc.flags=ffc_none; | |
| 16898 | } | ||
| 16899 | |||
| 16900 | 274752 | tempffc.updateSolid(); | |
| 16901 | |||
| 16902 | |||
| 16903 |
4/6✓ Branch 0 taken 274752 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 268748 times.
✓ Branch 3 taken 6004 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 268748 times.
|
274752 | if(Header->zelda_version == 0x211 || (Header->zelda_version == 0x250 && Header->build<20)) |
| 16904 | { | ||
| 16905 | ✗ | tempffc.flags|=ffc_ignoreholdup; | |
| 16906 | ✗ | } | |
| 16907 | |||
| 16908 |
1/2✓ Branch 0 taken 274752 times.
✗ Branch 1 not taken.
|
274752 | if(version>9) |
| 16909 | { | ||
| 16910 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_igetw(&(tempffc.script),f)) |
| 16911 | { | ||
| 16912 | ✗ | return qe_invalid; | |
| 16913 | } | ||
| 16914 | 274752 | } | |
| 16915 | else | ||
| 16916 | { | ||
| 16917 | ✗ | tempffc.script=0; | |
| 16918 | } | ||
| 16919 | |||
| 16920 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(version>10) |
| 16921 | { | ||
| 16922 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_igetl(&(tempffc.initd[0]),f)) |
| 16923 | { | ||
| 16924 | ✗ | return qe_invalid; | |
| 16925 | } | ||
| 16926 | |||
| 16927 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_igetl(&(tempffc.initd[1]),f)) |
| 16928 | { | ||
| 16929 | ✗ | return qe_invalid; | |
| 16930 | } | ||
| 16931 | |||
| 16932 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_igetl(&(tempffc.initd[2]),f)) |
| 16933 | { | ||
| 16934 | ✗ | return qe_invalid; | |
| 16935 | } | ||
| 16936 | |||
| 16937 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_igetl(&(tempffc.initd[3]),f)) |
| 16938 | { | ||
| 16939 | ✗ | return qe_invalid; | |
| 16940 | } | ||
| 16941 | |||
| 16942 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_igetl(&(tempffc.initd[4]),f)) |
| 16943 | { | ||
| 16944 | ✗ | return qe_invalid; | |
| 16945 | } | ||
| 16946 | |||
| 16947 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_igetl(&(tempffc.initd[5]),f)) |
| 16948 | { | ||
| 16949 | ✗ | return qe_invalid; | |
| 16950 | } | ||
| 16951 | |||
| 16952 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_igetl(&(tempffc.initd[6]),f)) |
| 16953 | { | ||
| 16954 | ✗ | return qe_invalid; | |
| 16955 | } | ||
| 16956 | |||
| 16957 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_igetl(&(tempffc.initd[7]),f)) |
| 16958 | { | ||
| 16959 | ✗ | return qe_invalid; | |
| 16960 | } | ||
| 16961 | |||
| 16962 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_getc(&(tempbyte),f)) |
| 16963 | { | ||
| 16964 | ✗ | return qe_invalid; | |
| 16965 | } | ||
| 16966 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274752 times.
|
274752 | if(!p_getc(&(tempbyte),f)) |
| 16967 | { | ||
| 16968 | ✗ | return qe_invalid; | |
| 16969 | } | ||
| 16970 | 274752 | } | |
| 16971 | |||
| 16972 |
1/2✓ Branch 0 taken 274752 times.
✗ Branch 1 not taken.
|
274752 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 16973 | { | ||
| 16974 | ✗ | tempffc.script = 0; | |
| 16975 | ✗ | for(int q = 0; q < 8; ++q) | |
| 16976 | ✗ | tempffc.initd[q] = 0; | |
| 16977 | ✗ | } | |
| 16978 |
1/2✓ Branch 0 taken 274752 times.
✗ Branch 1 not taken.
|
274752 | if(version <= 11) |
| 16979 | { | ||
| 16980 | ✗ | fixffcs=true; | |
| 16981 | ✗ | } | |
| 16982 | 274752 | } | |
| 16983 | 20811264 | } | |
| 16984 | |||
| 16985 | 650352 | temp_mapscr->shrinkToFitFFCs(); | |
| 16986 | 650352 | } | |
| 16987 | |||
| 16988 | |||
| 16989 | //add in the new whistle flags | ||
| 16990 |
2/2✓ Branch 0 taken 650352 times.
✓ Branch 1 taken 520072 times.
|
1170424 | if(version<13) |
| 16991 | { | ||
| 16992 |
2/2✓ Branch 0 taken 123 times.
✓ Branch 1 taken 519949 times.
|
520072 | if(temp_mapscr->flags & fWHISTLE) |
| 16993 | { | ||
| 16994 | 123 | temp_mapscr->flags7 |= (fWHISTLEPAL | fWHISTLEWATER); | |
| 16995 | 123 | } | |
| 16996 | 520072 | } | |
| 16997 | |||
| 16998 | //2.55 starts here | ||
| 16999 |
3/4✓ Branch 0 taken 34408 times.
✓ Branch 1 taken 1136016 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 34408 times.
|
1170424 | if ( version >= 19 && Header->zelda_version > 0x253 ) |
| 17000 | { | ||
| 17001 | // mapscr fields that were never used, so are now removed: | ||
| 17002 | // int32_t npcstrings[10]; | ||
| 17003 | // int16_t new_items[10]; | ||
| 17004 | // int16_t new_item_x[10]; | ||
| 17005 | // int16_t new_item_y[10]; | ||
| 17006 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34408 times.
|
34408 | if (pack_fseek(f, 100)) |
| 17007 | { | ||
| 17008 | ✗ | return qe_invalid; | |
| 17009 | } | ||
| 17010 | 34408 | } | |
| 17011 | |||
| 17012 |
3/4✓ Branch 0 taken 34408 times.
✓ Branch 1 taken 1136016 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 34408 times.
|
1170424 | if ( version >= 20 && Header->zelda_version > 0x253 ) |
| 17013 | { | ||
| 17014 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34408 times.
|
34408 | if(!p_igetw(&(temp_mapscr->script),f)) |
| 17015 | { | ||
| 17016 | ✗ | return qe_invalid; | |
| 17017 | } | ||
| 17018 |
2/2✓ Branch 0 taken 275264 times.
✓ Branch 1 taken 34408 times.
|
309672 | for ( int32_t q = 0; q < 8; q++) |
| 17019 | { | ||
| 17020 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 275264 times.
|
275264 | if(!p_igetl(&(temp_mapscr->screeninitd[q]),f)) |
| 17021 | { | ||
| 17022 | ✗ | return qe_invalid; | |
| 17023 | } | ||
| 17024 | 275264 | } | |
| 17025 | 34408 | } | |
| 17026 |
2/2✓ Branch 0 taken 1136016 times.
✓ Branch 1 taken 34408 times.
|
1170424 | if ( version < 20 ) |
| 17027 | { | ||
| 17028 | 1136016 | temp_mapscr->script = 0; | |
| 17029 |
2/2✓ Branch 0 taken 9088128 times.
✓ Branch 1 taken 1136016 times.
|
10224144 | for ( int32_t q = 0; q < 8; q++) temp_mapscr->screeninitd[q] = 0; |
| 17030 | 1136016 | } | |
| 17031 |
3/4✓ Branch 0 taken 34408 times.
✓ Branch 1 taken 1136016 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 34408 times.
|
1170424 | if ( version >= 21 && Header->zelda_version > 0x253 ) |
| 17032 | { | ||
| 17033 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34408 times.
|
34408 | if(!p_getc(&(temp_mapscr->preloadscript),f)) |
| 17034 | { | ||
| 17035 | ✗ | return qe_invalid; | |
| 17036 | } | ||
| 17037 | 34408 | } | |
| 17038 |
2/2✓ Branch 0 taken 34408 times.
✓ Branch 1 taken 1136016 times.
|
1170424 | if ( version < 21 ) |
| 17039 | { | ||
| 17040 | 1136016 | temp_mapscr->preloadscript = 0; | |
| 17041 | 1136016 | } | |
| 17042 | |||
| 17043 |
3/4✓ Branch 0 taken 34408 times.
✓ Branch 1 taken 1136016 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 34408 times.
|
1170424 | if ( version >= 22 && Header->zelda_version > 0x253 ) //26th June, 2019; Layer Visibility |
| 17044 | { | ||
| 17045 |
1/2✓ Branch 0 taken 34408 times.
✗ Branch 1 not taken.
|
34408 | if(!p_getc(&(temp_mapscr->hidelayers ),f)) |
| 17046 | { | ||
| 17047 | ✗ | return qe_invalid; | |
| 17048 | } | ||
| 17049 |
1/2✓ Branch 0 taken 34408 times.
✗ Branch 1 not taken.
|
34408 | if(!p_getc(&(temp_mapscr->hidescriptlayers ),f)) |
| 17050 | { | ||
| 17051 | ✗ | return qe_invalid; | |
| 17052 | } | ||
| 17053 | 34408 | } | |
| 17054 |
2/2✓ Branch 0 taken 34408 times.
✓ Branch 1 taken 1136016 times.
|
1170424 | if ( version < 22 ) |
| 17055 | { | ||
| 17056 | 1136016 | temp_mapscr->hidelayers = 0; | |
| 17057 | 1136016 | temp_mapscr->hidescriptlayers = 0; | |
| 17058 | 1136016 | } | |
| 17059 | |||
| 17060 | //Dodongos in 2.10 used the boss roar, not the dodongo sound. -Z | ||
| 17061 | //May be any version before 2.11. -Z | ||
| 17062 | /* --not the roar, the HIT SFX | ||
| 17063 | if ( Header->zelda_version <= 0x210 ) | ||
| 17064 | { | ||
| 17065 | if ( temp_mapscr->bosssfx == WAV_DODONGO ) | ||
| 17066 | { | ||
| 17067 | temp_mapscr->bosssfx = WAV_ROAR; | ||
| 17068 | } | ||
| 17069 | } | ||
| 17070 | */ | ||
| 17071 |
2/2✓ Branch 0 taken 4681696 times.
✓ Branch 1 taken 1170424 times.
|
5852120 | for(int32_t k=0; k<4; k++) |
| 17072 | { | ||
| 17073 |
1/2✓ Branch 0 taken 4681696 times.
✗ Branch 1 not taken.
|
4681696 | if(temp_mapscr->door[k] == dNONE) |
| 17074 | ✗ | temp_mapscr->door[k] = dWALL; | |
| 17075 | 4681696 | } | |
| 17076 | |||
| 17077 | 1170424 | return 0; | |
| 17078 | 1170424 | } | |
| 17079 | 1554624 | int32_t readmapscreen(PACKFILE *f, zquestheader *Header, mapscr *temp_mapscr, word version, int scrind, bool keep_music) | |
| 17080 | { | ||
| 17081 |
2/2✓ Branch 0 taken 1170424 times.
✓ Branch 1 taken 384200 times.
|
1554624 | if(version < 23) |
| 17082 | { | ||
| 17083 | 1170424 | auto ret = readmapscreen_old(f,Header,temp_mapscr,version,scrind,keep_music); | |
| 17084 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1170424 times.
|
1170424 | if(ret) return ret; |
| 17085 | 1170424 | } | |
| 17086 | else | ||
| 17087 | { | ||
| 17088 |
1/2✓ Branch 0 taken 384200 times.
✗ Branch 1 not taken.
|
384200 | if(!p_getc(&(temp_mapscr->valid),f)) |
| 17089 | ✗ | return qe_invalid; | |
| 17090 |
2/2✓ Branch 0 taken 194017 times.
✓ Branch 1 taken 190183 times.
|
384200 | if(!(temp_mapscr->valid & mVALID)) |
| 17091 | { | ||
| 17092 | 190183 | int map = scrind/MAPSCRS; | |
| 17093 | 190183 | int screen = scrind%MAPSCRS; | |
| 17094 |
4/6✓ Branch 0 taken 183081 times.
✓ Branch 1 taken 7102 times.
✓ Branch 2 taken 183081 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 183081 times.
|
190183 | if(version > 25 && scrind > -1 && map < map_infos.size()) |
| 17095 | { | ||
| 17096 | 183081 | auto const& mapinf = map_infos[map]; | |
| 17097 | //Empty screen, apply defaults | ||
| 17098 |
2/2✓ Branch 0 taken 1098486 times.
✓ Branch 1 taken 183081 times.
|
1281567 | for(int q = 0; q < 6; ++q) |
| 17099 | { | ||
| 17100 | 1098486 | auto layermap = mapinf.autolayers[q]; | |
| 17101 | 1098486 | temp_mapscr->layermap[q] = layermap; | |
| 17102 |
2/2✓ Branch 0 taken 1026888 times.
✓ Branch 1 taken 71598 times.
|
1098486 | if(layermap) |
| 17103 | 71598 | temp_mapscr->layerscreen[q] = screen; | |
| 17104 | 1098486 | } | |
| 17105 | 183081 | temp_mapscr->color = mapinf.autopalette; | |
| 17106 | 183081 | } | |
| 17107 | 190183 | return 0; | |
| 17108 | } | ||
| 17109 | uint32_t scr_has_flags; | ||
| 17110 |
1/2✓ Branch 0 taken 194017 times.
✗ Branch 1 not taken.
|
194017 | if(!p_igetl(&scr_has_flags,f)) |
| 17111 | ✗ | return qe_invalid; | |
| 17112 | |||
| 17113 |
2/2✓ Branch 0 taken 10458 times.
✓ Branch 1 taken 183559 times.
|
194017 | if(scr_has_flags & SCRHAS_ROOMDATA) |
| 17114 | { | ||
| 17115 |
1/2✓ Branch 0 taken 183559 times.
✗ Branch 1 not taken.
|
183559 | if(!p_getc(&(temp_mapscr->guy),f)) |
| 17116 | ✗ | return qe_invalid; | |
| 17117 |
2/2✓ Branch 0 taken 183439 times.
✓ Branch 1 taken 120 times.
|
183559 | if(version > 26) |
| 17118 | { | ||
| 17119 |
1/2✓ Branch 0 taken 183439 times.
✗ Branch 1 not taken.
|
183439 | if(!p_igetl(&(temp_mapscr->guytile),f)) |
| 17120 | ✗ | return qe_invalid; | |
| 17121 |
1/2✓ Branch 0 taken 183439 times.
✗ Branch 1 not taken.
|
183439 | if(!p_getc(&(temp_mapscr->guycs),f)) |
| 17122 | ✗ | return qe_invalid; | |
| 17123 |
1/2✓ Branch 0 taken 183439 times.
✗ Branch 1 not taken.
|
183439 | if(!p_igetw(&(temp_mapscr->roomflags),f)) |
| 17124 | ✗ | return qe_invalid; | |
| 17125 | 183439 | } | |
| 17126 | else | ||
| 17127 | { | ||
| 17128 | 120 | temp_mapscr->guytile = -1; //signal to use default guy values | |
| 17129 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
|
120 | SETFLAG(temp_mapscr->roomflags,RFL_ALWAYS_GUY,temp_mapscr->guy==gFAIRY); |
| 17130 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
120 | SETFLAG(temp_mapscr->roomflags,RFL_GUYFIRES,temp_mapscr->guy!=gFAIRY || !get_qr(qr_NOFAIRYGUYFIRES)); |
| 17131 | } | ||
| 17132 |
1/2✓ Branch 0 taken 183559 times.
✗ Branch 1 not taken.
|
183559 | if(!p_igetw(&(temp_mapscr->str),f)) |
| 17133 | ✗ | return qe_invalid; | |
| 17134 |
1/2✓ Branch 0 taken 183559 times.
✗ Branch 1 not taken.
|
183559 | if(!p_getc(&(temp_mapscr->room),f)) |
| 17135 | ✗ | return qe_invalid; | |
| 17136 |
1/2✓ Branch 0 taken 183559 times.
✗ Branch 1 not taken.
|
183559 | if(!p_igetw(&(temp_mapscr->catchall),f)) |
| 17137 | ✗ | return qe_invalid; | |
| 17138 | 183559 | } | |
| 17139 |
2/2✓ Branch 0 taken 189130 times.
✓ Branch 1 taken 4887 times.
|
194017 | if(scr_has_flags & SCRHAS_ITEM) |
| 17140 | { | ||
| 17141 |
1/2✓ Branch 0 taken 4887 times.
✗ Branch 1 not taken.
|
4887 | if(!p_getc(&(temp_mapscr->item),f)) |
| 17142 | ✗ | return qe_invalid; | |
| 17143 |
1/2✓ Branch 0 taken 4887 times.
✗ Branch 1 not taken.
|
4887 | if(!p_getc(&(temp_mapscr->hasitem),f)) |
| 17144 | ✗ | return qe_invalid; | |
| 17145 |
1/2✓ Branch 0 taken 4887 times.
✗ Branch 1 not taken.
|
4887 | if(!p_getc(&(temp_mapscr->itemx),f)) |
| 17146 | ✗ | return qe_invalid; | |
| 17147 |
1/2✓ Branch 0 taken 4887 times.
✗ Branch 1 not taken.
|
4887 | if(!p_getc(&(temp_mapscr->itemy),f)) |
| 17148 | ✗ | return qe_invalid; | |
| 17149 | 4887 | } | |
| 17150 |
2/2✓ Branch 0 taken 176089 times.
✓ Branch 1 taken 17928 times.
|
194017 | if(scr_has_flags & (SCRHAS_SWARP|SCRHAS_TWARP)) |
| 17151 | { | ||
| 17152 |
1/2✓ Branch 0 taken 17928 times.
✗ Branch 1 not taken.
|
17928 | if(!p_igetw(&temp_mapscr->warpreturnc,f)) |
| 17153 | ✗ | return qe_invalid; | |
| 17154 | 17928 | } | |
| 17155 |
2/2✓ Branch 0 taken 186909 times.
✓ Branch 1 taken 7108 times.
|
194017 | if(scr_has_flags & SCRHAS_TWARP) |
| 17156 | { | ||
| 17157 |
2/2✓ Branch 0 taken 28432 times.
✓ Branch 1 taken 7108 times.
|
35540 | for(int32_t i=0; i<4; i++) |
| 17158 | { | ||
| 17159 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28432 times.
|
28432 | if(!p_getc(&(temp_mapscr->tilewarptype[i]),f)) |
| 17160 | ✗ | return qe_invalid; | |
| 17161 | 28432 | } | |
| 17162 |
2/2✓ Branch 0 taken 28432 times.
✓ Branch 1 taken 7108 times.
|
35540 | for(int32_t i=0; i<4; i++) |
| 17163 | { | ||
| 17164 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28432 times.
|
28432 | if(!p_igetw(&(temp_mapscr->tilewarpdmap[i]),f)) |
| 17165 | ✗ | return qe_invalid; | |
| 17166 | 28432 | } | |
| 17167 |
2/2✓ Branch 0 taken 28432 times.
✓ Branch 1 taken 7108 times.
|
35540 | for(int32_t i=0; i<4; i++) |
| 17168 | { | ||
| 17169 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28432 times.
|
28432 | if(!p_getc(&(temp_mapscr->tilewarpscr[i]),f)) |
| 17170 | ✗ | return qe_invalid; | |
| 17171 | 28432 | } | |
| 17172 |
1/2✓ Branch 0 taken 7108 times.
✗ Branch 1 not taken.
|
7108 | if(!p_getc(&(temp_mapscr->tilewarpoverlayflags),f)) |
| 17173 | ✗ | return qe_invalid; | |
| 17174 | 7108 | } | |
| 17175 |
2/2✓ Branch 0 taken 181785 times.
✓ Branch 1 taken 12232 times.
|
194017 | if(scr_has_flags & SCRHAS_SWARP) |
| 17176 | { | ||
| 17177 |
2/2✓ Branch 0 taken 48928 times.
✓ Branch 1 taken 12232 times.
|
61160 | for(int32_t i=0; i<4; i++) |
| 17178 | { | ||
| 17179 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48928 times.
|
48928 | if(!p_getc(&(temp_mapscr->sidewarptype[i]),f)) |
| 17180 | ✗ | return qe_invalid; | |
| 17181 | 48928 | } | |
| 17182 |
2/2✓ Branch 0 taken 48928 times.
✓ Branch 1 taken 12232 times.
|
61160 | for(int32_t i=0; i<4; i++) |
| 17183 | { | ||
| 17184 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48928 times.
|
48928 | if(!p_igetw(&(temp_mapscr->sidewarpdmap[i]),f)) |
| 17185 | ✗ | return qe_invalid; | |
| 17186 | 48928 | } | |
| 17187 |
2/2✓ Branch 0 taken 48928 times.
✓ Branch 1 taken 12232 times.
|
61160 | for(int32_t i=0; i<4; i++) |
| 17188 | { | ||
| 17189 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48928 times.
|
48928 | if(!p_getc(&(temp_mapscr->sidewarpscr[i]),f)) |
| 17190 | ✗ | return qe_invalid; | |
| 17191 | 48928 | } | |
| 17192 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12232 times.
|
12232 | if(!p_getc(&(temp_mapscr->sidewarpoverlayflags),f)) |
| 17193 | ✗ | return qe_invalid; | |
| 17194 |
1/2✓ Branch 0 taken 12232 times.
✗ Branch 1 not taken.
|
12232 | if(!p_getc(&(temp_mapscr->sidewarpindex),f)) |
| 17195 | ✗ | return qe_invalid; | |
| 17196 | 12232 | } | |
| 17197 |
2/2✓ Branch 0 taken 181184 times.
✓ Branch 1 taken 12833 times.
|
194017 | if(scr_has_flags & SCRHAS_WARPRET) |
| 17198 | { | ||
| 17199 |
2/2✓ Branch 0 taken 51332 times.
✓ Branch 1 taken 12833 times.
|
64165 | for(int32_t i=0; i<4; i++) |
| 17200 | { | ||
| 17201 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 51332 times.
|
51332 | if(!p_getc(&(temp_mapscr->warpreturnx[i]),f)) |
| 17202 | ✗ | return qe_invalid; | |
| 17203 | 51332 | } | |
| 17204 |
2/2✓ Branch 0 taken 51332 times.
✓ Branch 1 taken 12833 times.
|
64165 | for(int32_t i=0; i<4; i++) |
| 17205 | { | ||
| 17206 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 51332 times.
|
51332 | if(!p_getc(&(temp_mapscr->warpreturny[i]),f)) |
| 17207 | ✗ | return qe_invalid; | |
| 17208 | 51332 | } | |
| 17209 |
1/2✓ Branch 0 taken 12833 times.
✗ Branch 1 not taken.
|
12833 | if(!p_getc(&(temp_mapscr->warparrivalx),f)) |
| 17210 | ✗ | return qe_invalid; | |
| 17211 |
1/2✓ Branch 0 taken 12833 times.
✗ Branch 1 not taken.
|
12833 | if(!p_getc(&(temp_mapscr->warparrivaly),f)) |
| 17212 | ✗ | return qe_invalid; | |
| 17213 | 12833 | } | |
| 17214 |
2/2✓ Branch 0 taken 165284 times.
✓ Branch 1 taken 28733 times.
|
194017 | if(scr_has_flags & SCRHAS_LAYERS) |
| 17215 | { | ||
| 17216 |
2/2✓ Branch 0 taken 172398 times.
✓ Branch 1 taken 28733 times.
|
201131 | for(int32_t k=0; k<6; k++) |
| 17217 | { | ||
| 17218 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 172398 times.
|
172398 | if(!p_getc(&(temp_mapscr->layermap[k]),f)) |
| 17219 | ✗ | return qe_invalid; | |
| 17220 | 172398 | } | |
| 17221 |
2/2✓ Branch 0 taken 172398 times.
✓ Branch 1 taken 28733 times.
|
201131 | for(int32_t k=0; k<6; k++) |
| 17222 | { | ||
| 17223 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 172398 times.
|
172398 | if(!p_getc(&(temp_mapscr->layerscreen[k]),f)) |
| 17224 | ✗ | return qe_invalid; | |
| 17225 | 172398 | } | |
| 17226 |
2/2✓ Branch 0 taken 172398 times.
✓ Branch 1 taken 28733 times.
|
201131 | for(int32_t k=0; k<6; k++) |
| 17227 | { | ||
| 17228 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 172398 times.
|
172398 | if(!p_getc(&(temp_mapscr->layeropacity[k]),f)) |
| 17229 | ✗ | return qe_invalid; | |
| 17230 | 172398 | } | |
| 17231 |
1/2✓ Branch 0 taken 28733 times.
✗ Branch 1 not taken.
|
28733 | if(!p_getc(&(temp_mapscr->hidelayers),f)) |
| 17232 | ✗ | return qe_invalid; | |
| 17233 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28733 times.
|
28733 | if(!p_getc(&(temp_mapscr->hidescriptlayers),f)) |
| 17234 | ✗ | return qe_invalid; | |
| 17235 | 28733 | } | |
| 17236 |
2/2✓ Branch 0 taken 193913 times.
✓ Branch 1 taken 104 times.
|
194017 | if(scr_has_flags & SCRHAS_MAZE) |
| 17237 | { | ||
| 17238 |
2/2✓ Branch 0 taken 416 times.
✓ Branch 1 taken 104 times.
|
520 | for(int32_t k=0; k<4; k++) |
| 17239 | { | ||
| 17240 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 416 times.
|
416 | if(!p_getc(&(temp_mapscr->path[k]),f)) |
| 17241 | ✗ | return qe_invalid; | |
| 17242 | 416 | } | |
| 17243 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 104 times.
|
104 | if(!p_getc(&(temp_mapscr->exitdir),f)) |
| 17244 | ✗ | return qe_invalid; | |
| 17245 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 104 times.
|
104 | if (version >= 32) |
| 17246 | { | ||
| 17247 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 104 times.
|
104 | if (!p_getc(&temp_mapscr->maze_transition_wipe, f)) |
| 17248 | ✗ | return qe_invalid; | |
| 17249 | 104 | } | |
| 17250 | 104 | } | |
| 17251 |
2/2✓ Branch 0 taken 148265 times.
✓ Branch 1 taken 45752 times.
|
194017 | if(scr_has_flags & SCRHAS_D_S_U) |
| 17252 | { | ||
| 17253 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 148265 times.
|
148265 | if(!p_igetw(&(temp_mapscr->door_combo_set),f)) |
| 17254 | ✗ | return qe_invalid; | |
| 17255 |
2/2✓ Branch 0 taken 593060 times.
✓ Branch 1 taken 148265 times.
|
741325 | for(int32_t k=0; k<4; k++) |
| 17256 | { | ||
| 17257 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 593060 times.
|
593060 | if(!p_getc(&(temp_mapscr->door[k]),f)) |
| 17258 | ✗ | return qe_invalid; | |
| 17259 |
3/4✓ Branch 0 taken 360 times.
✓ Branch 1 taken 592700 times.
✓ Branch 2 taken 360 times.
✗ Branch 3 not taken.
|
593060 | if(version < 29 && temp_mapscr->door[k] == dNONE) |
| 17260 | ✗ | temp_mapscr->door[k] = dWALL; | |
| 17261 | 593060 | } | |
| 17262 | |||
| 17263 |
1/2✓ Branch 0 taken 148265 times.
✗ Branch 1 not taken.
|
148265 | if(!p_getc(&(temp_mapscr->stairx),f)) |
| 17264 | ✗ | return qe_invalid; | |
| 17265 | |||
| 17266 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 148265 times.
|
148265 | if(!p_getc(&(temp_mapscr->stairy),f)) |
| 17267 | ✗ | return qe_invalid; | |
| 17268 |
1/2✓ Branch 0 taken 148265 times.
✗ Branch 1 not taken.
|
148265 | if(!p_igetw(&(temp_mapscr->undercombo),f)) |
| 17269 | ✗ | return qe_invalid; | |
| 17270 |
1/2✓ Branch 0 taken 148265 times.
✗ Branch 1 not taken.
|
148265 | if(!p_getc(&(temp_mapscr->undercset),f)) |
| 17271 | ✗ | return qe_invalid; | |
| 17272 | 148265 | } | |
| 17273 |
2/2✓ Branch 0 taken 10488 times.
✓ Branch 1 taken 35264 times.
|
45752 | else if(version < 29) |
| 17274 | { | ||
| 17275 |
2/2✓ Branch 0 taken 41952 times.
✓ Branch 1 taken 10488 times.
|
52440 | for(int k = 0; k < 4; ++k) |
| 17276 | 41952 | temp_mapscr->door[k] = dWALL; | |
| 17277 | 10488 | } | |
| 17278 |
2/2✓ Branch 0 taken 179054 times.
✓ Branch 1 taken 14963 times.
|
194017 | if(scr_has_flags & SCRHAS_FLAGS) |
| 17279 | { | ||
| 17280 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14963 times.
|
14963 | if(!p_getc(&(temp_mapscr->flags),f)) |
| 17281 | ✗ | return qe_invalid; | |
| 17282 |
1/2✓ Branch 0 taken 14963 times.
✗ Branch 1 not taken.
|
14963 | if(!p_getc(&(temp_mapscr->flags2),f)) |
| 17283 | ✗ | return qe_invalid; | |
| 17284 |
1/2✓ Branch 0 taken 14963 times.
✗ Branch 1 not taken.
|
14963 | if(!p_getc(&(temp_mapscr->flags3),f)) |
| 17285 | ✗ | return qe_invalid; | |
| 17286 |
1/2✓ Branch 0 taken 14963 times.
✗ Branch 1 not taken.
|
14963 | if(!p_getc(&(temp_mapscr->flags4),f)) |
| 17287 | ✗ | return qe_invalid; | |
| 17288 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14963 times.
|
14963 | if(!p_getc(&(temp_mapscr->flags5),f)) |
| 17289 | ✗ | return qe_invalid; | |
| 17290 |
1/2✓ Branch 0 taken 14963 times.
✗ Branch 1 not taken.
|
14963 | if(!p_getc(&(temp_mapscr->flags6),f)) |
| 17291 | ✗ | return qe_invalid; | |
| 17292 |
1/2✓ Branch 0 taken 14963 times.
✗ Branch 1 not taken.
|
14963 | if(!p_getc(&(temp_mapscr->flags7),f)) |
| 17293 | ✗ | return qe_invalid; | |
| 17294 |
1/2✓ Branch 0 taken 14963 times.
✗ Branch 1 not taken.
|
14963 | if(!p_getc(&(temp_mapscr->flags8),f)) |
| 17295 | ✗ | return qe_invalid; | |
| 17296 |
1/2✓ Branch 0 taken 14963 times.
✗ Branch 1 not taken.
|
14963 | if(!p_getc(&(temp_mapscr->flags9),f)) |
| 17297 | ✗ | return qe_invalid; | |
| 17298 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14963 times.
|
14963 | if(!p_getc(&(temp_mapscr->flags10),f)) |
| 17299 | ✗ | return qe_invalid; | |
| 17300 |
1/2✓ Branch 0 taken 14963 times.
✗ Branch 1 not taken.
|
14963 | if(!p_getc(&(temp_mapscr->flags11),f)) |
| 17301 | ✗ | return qe_invalid; | |
| 17302 | 14963 | } | |
| 17303 |
2/2✓ Branch 0 taken 180296 times.
✓ Branch 1 taken 13721 times.
|
194017 | if(scr_has_flags & SCRHAS_ENEMY) |
| 17304 | { | ||
| 17305 |
2/2✓ Branch 0 taken 137210 times.
✓ Branch 1 taken 13721 times.
|
150931 | for(int32_t k=0; k<10; k++) |
| 17306 | { | ||
| 17307 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 137210 times.
|
137210 | if(!p_igetw(&(temp_mapscr->enemy[k]),f)) |
| 17308 | ✗ | return qe_invalid; | |
| 17309 |
1/2✓ Branch 0 taken 137210 times.
✗ Branch 1 not taken.
|
137210 | if (unsigned(temp_mapscr->enemy[k]) > MAXGUYS) |
| 17310 | ✗ | temp_mapscr->enemy[k] = 0; | |
| 17311 | 137210 | } | |
| 17312 |
1/2✓ Branch 0 taken 13721 times.
✗ Branch 1 not taken.
|
13721 | if(!p_getc(&(temp_mapscr->pattern),f)) |
| 17313 | ✗ | return qe_invalid; | |
| 17314 | 13721 | } | |
| 17315 |
2/2✓ Branch 0 taken 153821 times.
✓ Branch 1 taken 40196 times.
|
194017 | if(scr_has_flags & SCRHAS_CARRY) |
| 17316 | { | ||
| 17317 |
2/2✓ Branch 0 taken 338 times.
✓ Branch 1 taken 153483 times.
|
153821 | if(version < 34) |
| 17318 | { | ||
| 17319 | word tmpw; | ||
| 17320 |
1/2✓ Branch 0 taken 338 times.
✗ Branch 1 not taken.
|
338 | if(!p_igetw(&tmpw,f)) |
| 17321 | ✗ | return qe_invalid; | |
| 17322 | 338 | temp_mapscr->noreset = tmpw | mLIGHTBEAM | mTMPNORET | mVISITED; | |
| 17323 |
1/2✓ Branch 0 taken 338 times.
✗ Branch 1 not taken.
|
338 | if(!p_igetw(&tmpw,f)) |
| 17324 | ✗ | return qe_invalid; | |
| 17325 | 676 | temp_mapscr->nocarry = tmpw | mLIGHTBEAM | mTMPNORET | mVISITED | | |
| 17326 | 338 | mDOOR_UP | mDOOR_DOWN | mDOOR_LEFT | mDOOR_RIGHT | mNEVERRET | mNO_ENEMIES_RETURN; | |
| 17327 | 338 | } | |
| 17328 | else | ||
| 17329 | { | ||
| 17330 |
1/2✓ Branch 0 taken 153483 times.
✗ Branch 1 not taken.
|
153483 | if(!p_igetl(&(temp_mapscr->noreset),f)) |
| 17331 | ✗ | return qe_invalid; | |
| 17332 |
1/2✓ Branch 0 taken 153483 times.
✗ Branch 1 not taken.
|
153483 | if(!p_igetl(&(temp_mapscr->nocarry),f)) |
| 17333 | ✗ | return qe_invalid; | |
| 17334 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 153483 times.
|
153483 | if(!p_igetl(&(temp_mapscr->exstate_reset),f)) |
| 17335 | ✗ | return qe_invalid; | |
| 17336 |
1/2✓ Branch 0 taken 153483 times.
✗ Branch 1 not taken.
|
153483 | if(!p_igetl(&(temp_mapscr->exstate_carry),f)) |
| 17337 | ✗ | return qe_invalid; | |
| 17338 | } | ||
| 17339 |
1/2✓ Branch 0 taken 153821 times.
✗ Branch 1 not taken.
|
153821 | if(!p_getc(&(temp_mapscr->nextmap),f)) |
| 17340 | ✗ | return qe_invalid; | |
| 17341 |
1/2✓ Branch 0 taken 153821 times.
✗ Branch 1 not taken.
|
153821 | if(!p_getc(&(temp_mapscr->nextscr),f)) |
| 17342 | ✗ | return qe_invalid; | |
| 17343 | 153821 | } | |
| 17344 | else | ||
| 17345 | { | ||
| 17346 |
2/2✓ Branch 0 taken 757 times.
✓ Branch 1 taken 39439 times.
|
40196 | if(version < 34) |
| 17347 | { | ||
| 17348 | 39439 | temp_mapscr->noreset = mLIGHTBEAM | mTMPNORET | mVISITED; | |
| 17349 | 39439 | temp_mapscr->nocarry = mLIGHTBEAM | mTMPNORET | mVISITED | | |
| 17350 | mDOOR_UP | mDOOR_DOWN | mDOOR_LEFT | mDOOR_RIGHT | mNEVERRET | mNO_ENEMIES_RETURN; | ||
| 17351 | 39439 | } | |
| 17352 | } | ||
| 17353 |
2/2✓ Branch 0 taken 193288 times.
✓ Branch 1 taken 729 times.
|
194017 | if(scr_has_flags & SCRHAS_SCRIPT) |
| 17354 | { | ||
| 17355 |
1/2✓ Branch 0 taken 729 times.
✗ Branch 1 not taken.
|
729 | if(!p_igetw(&(temp_mapscr->script),f)) |
| 17356 | ✗ | return qe_invalid; | |
| 17357 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 729 times.
|
729 | if(!p_getc(&(temp_mapscr->preloadscript),f)) |
| 17358 | ✗ | return qe_invalid; | |
| 17359 |
2/2✓ Branch 0 taken 5832 times.
✓ Branch 1 taken 729 times.
|
6561 | for ( int32_t q = 0; q < 8; q++ ) |
| 17360 | { | ||
| 17361 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5832 times.
|
5832 | if(!p_igetl(&(temp_mapscr->screeninitd[q]),f)) |
| 17362 | ✗ | return qe_invalid; | |
| 17363 | 5832 | } | |
| 17364 | 729 | } | |
| 17365 |
2/2✓ Branch 0 taken 154366 times.
✓ Branch 1 taken 39651 times.
|
194017 | if(scr_has_flags & SCRHAS_SECRETS) |
| 17366 | { | ||
| 17367 |
2/2✓ Branch 0 taken 5075328 times.
✓ Branch 1 taken 39651 times.
|
5114979 | for(int32_t k=0; k<128; k++) |
| 17368 | { | ||
| 17369 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5075328 times.
|
5075328 | if(!p_igetw(&(temp_mapscr->secretcombo[k]),f)) |
| 17370 | ✗ | return qe_invalid; | |
| 17371 | 5075328 | } | |
| 17372 |
2/2✓ Branch 0 taken 5075328 times.
✓ Branch 1 taken 39651 times.
|
5114979 | for(int32_t k=0; k<128; k++) |
| 17373 | { | ||
| 17374 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5075328 times.
|
5075328 | if(!p_getc(&(temp_mapscr->secretcset[k]),f)) |
| 17375 | ✗ | return qe_invalid; | |
| 17376 | 5075328 | } | |
| 17377 |
2/2✓ Branch 0 taken 5075328 times.
✓ Branch 1 taken 39651 times.
|
5114979 | for(int32_t k=0; k<128; k++) |
| 17378 | { | ||
| 17379 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5075328 times.
|
5075328 | if(!p_getc(&(temp_mapscr->secretflag[k]),f)) |
| 17380 | ✗ | return qe_invalid; | |
| 17381 | 5075328 | } | |
| 17382 | 39651 | } | |
| 17383 |
2/2✓ Branch 0 taken 74452 times.
✓ Branch 1 taken 119565 times.
|
194017 | if(scr_has_flags & SCRHAS_COMBOFLAG) |
| 17384 | { | ||
| 17385 |
2/2✓ Branch 0 taken 21043440 times.
✓ Branch 1 taken 119565 times.
|
21163005 | for(int32_t k=0; k<176; ++k) |
| 17386 | { | ||
| 17387 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21043440 times.
|
21043440 | if(!p_igetw(&(temp_mapscr->data[k]),f)) |
| 17388 | ✗ | return qe_invalid; | |
| 17389 | 21043440 | } | |
| 17390 |
2/2✓ Branch 0 taken 21043440 times.
✓ Branch 1 taken 119565 times.
|
21163005 | for(int32_t k=0; k<176; ++k) |
| 17391 | { | ||
| 17392 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21043440 times.
|
21043440 | if(!p_getc(&(temp_mapscr->sflag[k]),f)) |
| 17393 | ✗ | return qe_invalid; | |
| 17394 | 21043440 | } | |
| 17395 |
2/2✓ Branch 0 taken 21043440 times.
✓ Branch 1 taken 119565 times.
|
21163005 | for(int32_t k=0; k<176; ++k) |
| 17396 | { | ||
| 17397 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21043440 times.
|
21043440 | if(!p_getc(&(temp_mapscr->cset[k]),f)) |
| 17398 | ✗ | return qe_invalid; | |
| 17399 | 21043440 | } | |
| 17400 | 119565 | } | |
| 17401 |
1/2✓ Branch 0 taken 194017 times.
✗ Branch 1 not taken.
|
194017 | if(scr_has_flags & SCRHAS_MISC) |
| 17402 | { | ||
| 17403 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 194017 times.
|
194017 | if(!p_igetw(&(temp_mapscr->color),f)) |
| 17404 | ✗ | return qe_invalid; | |
| 17405 |
1/2✓ Branch 0 taken 194017 times.
✗ Branch 1 not taken.
|
194017 | if(!p_getc(&(temp_mapscr->csensitive),f)) |
| 17406 | ✗ | return qe_invalid; | |
| 17407 |
1/2✓ Branch 0 taken 194017 times.
✗ Branch 1 not taken.
|
194017 | if(!p_getc(&(temp_mapscr->oceansfx),f)) |
| 17408 | ✗ | return qe_invalid; | |
| 17409 |
1/2✓ Branch 0 taken 194017 times.
✗ Branch 1 not taken.
|
194017 | if(!p_getc(&(temp_mapscr->bosssfx),f)) |
| 17410 | ✗ | return qe_invalid; | |
| 17411 |
1/2✓ Branch 0 taken 194017 times.
✗ Branch 1 not taken.
|
194017 | if(!p_getc(&(temp_mapscr->secretsfx),f)) |
| 17412 | ✗ | return qe_invalid; | |
| 17413 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 194017 times.
|
194017 | if(!p_getc(&(temp_mapscr->holdupsfx),f)) |
| 17414 | ✗ | return qe_invalid; | |
| 17415 |
1/2✓ Branch 0 taken 194017 times.
✗ Branch 1 not taken.
|
194017 | if(!p_igetw(&(temp_mapscr->timedwarptics),f)) |
| 17416 | ✗ | return qe_invalid; | |
| 17417 |
2/2✓ Branch 0 taken 156969 times.
✓ Branch 1 taken 37048 times.
|
194017 | if (version < 37) |
| 17418 | { | ||
| 17419 | int16_t m; | ||
| 17420 |
1/2✓ Branch 0 taken 156969 times.
✗ Branch 1 not taken.
|
156969 | if(!p_igetw(&m, f)) |
| 17421 | ✗ | return qe_invalid; | |
| 17422 |
2/2✓ Branch 0 taken 156879 times.
✓ Branch 1 taken 90 times.
|
156969 | if (m <= 0) |
| 17423 | 156879 | temp_mapscr->music = vbound(m, 0, -1); | |
| 17424 |
1/2✓ Branch 0 taken 90 times.
✗ Branch 1 not taken.
|
90 | else if (!keep_music) // can't safely convert without modifying quest_music, so just use -1 |
| 17425 | ✗ | temp_mapscr->music = -1; | |
| 17426 | 90 | else temp_mapscr->music = find_or_make_midi_music(convert_from_old_midi_id(m + (MIDIOFFSET_MAPSCR - MIDIOFFSET_ZSCRIPT), true)); | |
| 17427 | 156969 | } | |
| 17428 |
1/2✓ Branch 0 taken 37048 times.
✗ Branch 1 not taken.
|
37048 | else if (!p_igetl(&(temp_mapscr->music), f)) |
| 17429 | ✗ | return qe_invalid; | |
| 17430 |
1/2✓ Branch 0 taken 194017 times.
✗ Branch 1 not taken.
|
194017 | if(!p_getc(&(temp_mapscr->lens_layer),f)) |
| 17431 | ✗ | return qe_invalid; | |
| 17432 |
2/2✓ Branch 0 taken 10578 times.
✓ Branch 1 taken 183439 times.
|
194017 | if(version > 27) |
| 17433 | { | ||
| 17434 |
1/2✓ Branch 0 taken 183439 times.
✗ Branch 1 not taken.
|
183439 | if(!p_getc(&(temp_mapscr->lens_show),f)) |
| 17435 | ✗ | return qe_invalid; | |
| 17436 |
1/2✓ Branch 0 taken 183439 times.
✗ Branch 1 not taken.
|
183439 | if(!p_getc(&(temp_mapscr->lens_hide),f)) |
| 17437 | ✗ | return qe_invalid; | |
| 17438 | 183439 | } | |
| 17439 | 194017 | } | |
| 17440 | else | ||
| 17441 | { | ||
| 17442 | ✗ | temp_mapscr->music = -1; | |
| 17443 | ✗ | temp_mapscr->csensitive = 1; | |
| 17444 | } | ||
| 17445 | //FFC | ||
| 17446 | 194017 | bool old_ff = version < 25; | |
| 17447 | 194017 | dword bits = 0; | |
| 17448 | 194017 | word numffc = 32; | |
| 17449 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 194017 times.
|
194017 | if(old_ff) |
| 17450 | { | ||
| 17451 | ✗ | if(!p_igetl(&bits,f)) | |
| 17452 | ✗ | return qe_invalid; | |
| 17453 | ✗ | } | |
| 17454 | else | ||
| 17455 | { | ||
| 17456 |
2/4✓ Branch 0 taken 194017 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 194017 times.
|
194017 | if(!p_igetw(&numffc,f) || numffc > MAXFFCS) |
| 17457 | ✗ | return qe_invalid; | |
| 17458 | } | ||
| 17459 | |||
| 17460 | 194017 | temp_mapscr->ffcCountMarkDirty(); | |
| 17461 | 194017 | temp_mapscr->ffcs.clear(); | |
| 17462 | 194017 | temp_mapscr->resizeFFC(numffc); | |
| 17463 | |||
| 17464 | byte tempbyte; | ||
| 17465 | word tempw; | ||
| 17466 |
4/6✓ Branch 0 taken 176 times.
✓ Branch 1 taken 193841 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 176 times.
✓ Branch 4 taken 176 times.
✗ Branch 5 not taken.
|
194017 | static ffcdata nil_ffc; |
| 17467 |
2/2✓ Branch 0 taken 1997090 times.
✓ Branch 1 taken 194017 times.
|
2191107 | for(word m = 0; m < numffc; ++m) |
| 17468 | { | ||
| 17469 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1997090 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1997090 | if(old_ff && !(bits & (1<<m))) continue; |
| 17470 | |||
| 17471 |
1/2✓ Branch 0 taken 1997090 times.
✗ Branch 1 not taken.
|
1997090 | ffcdata& tempffc = (m < MAXFFCS) |
| 17472 | 1997090 | ? temp_mapscr->ffcs[m] | |
| 17473 | : nil_ffc; //sanity | ||
| 17474 | |||
| 17475 |
1/2✓ Branch 0 taken 1997090 times.
✗ Branch 1 not taken.
|
1997090 | if(!p_igetw(&tempw,f)) |
| 17476 | ✗ | return qe_invalid; | |
| 17477 |
3/4✓ Branch 0 taken 1997090 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28170 times.
✓ Branch 3 taken 1968920 times.
|
1997090 | if(!old_ff && !tempw) //empty ffc, nothing more to load |
| 17478 | 1968920 | continue; | |
| 17479 | 28170 | tempffc.data = tempw; | |
| 17480 | |||
| 17481 |
1/2✓ Branch 0 taken 28170 times.
✗ Branch 1 not taken.
|
28170 | if(!p_getc(&(tempffc.cset),f)) |
| 17482 | ✗ | return qe_invalid; | |
| 17483 |
1/2✓ Branch 0 taken 28170 times.
✗ Branch 1 not taken.
|
28170 | if(!p_igetw(&(tempffc.delay),f)) |
| 17484 | ✗ | return qe_invalid; | |
| 17485 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28170 times.
|
28170 | if(!p_igetzf(&(tempffc.x),f)) |
| 17486 | ✗ | return qe_invalid; | |
| 17487 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28170 times.
|
28170 | if(!p_igetzf(&(tempffc.y),f)) |
| 17488 | ✗ | return qe_invalid; | |
| 17489 |
1/2✓ Branch 0 taken 28170 times.
✗ Branch 1 not taken.
|
28170 | if(!p_igetzf(&(tempffc.vx),f)) |
| 17490 | ✗ | return qe_invalid; | |
| 17491 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28170 times.
|
28170 | if(!p_igetzf(&(tempffc.vy),f)) |
| 17492 | ✗ | return qe_invalid; | |
| 17493 |
1/2✓ Branch 0 taken 28170 times.
✗ Branch 1 not taken.
|
28170 | if(!p_igetzf(&(tempffc.ax),f)) |
| 17494 | ✗ | return qe_invalid; | |
| 17495 |
1/2✓ Branch 0 taken 28170 times.
✗ Branch 1 not taken.
|
28170 | if(!p_igetzf(&(tempffc.ay),f)) |
| 17496 | ✗ | return qe_invalid; | |
| 17497 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28170 times.
|
28170 | if(!p_getc(&(tempffc.link),f)) |
| 17498 | ✗ | return qe_invalid; | |
| 17499 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28170 times.
|
28170 | if(version < 24) |
| 17500 | { | ||
| 17501 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 17502 | ✗ | return qe_invalid; | |
| 17503 | ✗ | tempffc.hit_width = (tempbyte&0x3F)+1; | |
| 17504 | ✗ | tempffc.txsz = (tempbyte>>6)+1; | |
| 17505 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 17506 | ✗ | return qe_invalid; | |
| 17507 | ✗ | tempffc.hit_height = (tempbyte&0x3F)+1; | |
| 17508 | ✗ | tempffc.tysz = (tempbyte>>6)+1; | |
| 17509 | ✗ | } | |
| 17510 | else | ||
| 17511 | { | ||
| 17512 |
1/2✓ Branch 0 taken 28170 times.
✗ Branch 1 not taken.
|
28170 | if(!p_igetl(&(tempffc.hit_width),f)) |
| 17513 | ✗ | return qe_invalid; | |
| 17514 |
1/2✓ Branch 0 taken 28170 times.
✗ Branch 1 not taken.
|
28170 | if(!p_igetl(&(tempffc.hit_height),f)) |
| 17515 | ✗ | return qe_invalid; | |
| 17516 |
1/2✓ Branch 0 taken 28170 times.
✗ Branch 1 not taken.
|
28170 | if(!p_getc(&(tempffc.txsz),f)) |
| 17517 | ✗ | return qe_invalid; | |
| 17518 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28170 times.
|
28170 | if(!p_getc(&(tempffc.tysz),f)) |
| 17519 | ✗ | return qe_invalid; | |
| 17520 | } | ||
| 17521 |
1/2✓ Branch 0 taken 28170 times.
✗ Branch 1 not taken.
|
28170 | if(!p_igetl(&(tempffc.flags),f)) |
| 17522 | ✗ | return qe_invalid; | |
| 17523 | 28170 | tempffc.updateSolid(); | |
| 17524 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28170 times.
|
28170 | if(!p_igetw(&(tempffc.script),f)) |
| 17525 | ✗ | return qe_invalid; | |
| 17526 |
2/2✓ Branch 0 taken 225360 times.
✓ Branch 1 taken 28170 times.
|
253530 | for(auto q = 0; q < 8; ++q) |
| 17527 | { | ||
| 17528 |
1/2✓ Branch 0 taken 225360 times.
✗ Branch 1 not taken.
|
225360 | if(!p_igetl(&(tempffc.initd[q]),f)) |
| 17529 | ✗ | return qe_invalid; | |
| 17530 | 225360 | } | |
| 17531 |
2/2✓ Branch 0 taken 7792 times.
✓ Branch 1 taken 20378 times.
|
28170 | if(version < 33) |
| 17532 | { | ||
| 17533 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7792 times.
|
7792 | if(!p_getc(&(tempbyte),f)) |
| 17534 | ✗ | return qe_invalid; | |
| 17535 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7792 times.
|
7792 | if(!p_getc(&(tempbyte),f)) |
| 17536 | ✗ | return qe_invalid; | |
| 17537 | 7792 | } | |
| 17538 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20378 times.
|
20378 | else if(!p_getc(&(tempffc.layer),f)) |
| 17539 | ✗ | return qe_invalid; | |
| 17540 | |||
| 17541 |
1/2✓ Branch 0 taken 28170 times.
✗ Branch 1 not taken.
|
28170 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 17542 | { | ||
| 17543 | ✗ | tempffc.script = 0; | |
| 17544 | ✗ | for(int q = 0; q < 8; ++q) | |
| 17545 | ✗ | tempffc.initd[q] = 0; | |
| 17546 | ✗ | } | |
| 17547 | 28170 | } | |
| 17548 | //END FFC | ||
| 17549 |
2/2✓ Branch 0 taken 39375 times.
✓ Branch 1 taken 154642 times.
|
194017 | if(version > 29) |
| 17550 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 154642 times.
|
154642 | if(!p_getlstr(&temp_mapscr->usr_notes, f)) |
| 17551 | ✗ | return qe_invalid; | |
| 17552 | |||
| 17553 |
4/4✓ Branch 0 taken 67960 times.
✓ Branch 1 taken 126057 times.
✓ Branch 2 taken 67858 times.
✓ Branch 3 taken 102 times.
|
194017 | if (version >= 35 && (temp_mapscr->flags10 & fSCREEN_GRAVITY)) |
| 17554 | { | ||
| 17555 |
1/2✓ Branch 0 taken 102 times.
✗ Branch 1 not taken.
|
102 | if (!p_igetzf(&temp_mapscr->screen_gravity, f)) |
| 17556 | ✗ | return qe_invalid; | |
| 17557 |
1/2✓ Branch 0 taken 102 times.
✗ Branch 1 not taken.
|
102 | if (!p_igetzf(&temp_mapscr->screen_terminal_v, f)) |
| 17558 | ✗ | return qe_invalid; | |
| 17559 | 102 | } | |
| 17560 | } | ||
| 17561 | |||
| 17562 | 1364441 | temp_mapscr->shrinkToFitFFCs(); | |
| 17563 | |||
| 17564 | 1364441 | return 0; | |
| 17565 | 1554624 | } | |
| 17566 | |||
| 17567 | 497 | int32_t readmaps(PACKFILE *f, zquestheader *Header) | |
| 17568 | { | ||
| 17569 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 24 times.
|
497 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_maps); |
| 17570 | 497 | int32_t screen=0; | |
| 17571 | |||
| 17572 | 497 | word version=0; | |
| 17573 | dword dummy; | ||
| 17574 | int32_t screens_to_read; | ||
| 17575 | |||
| 17576 | 497 | mapscr temp_mapscr{}; | |
| 17577 | word temp_map_count; | ||
| 17578 | dword section_size; | ||
| 17579 | |||
| 17580 |
5/6✓ Branch 0 taken 479 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 473 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
|
497 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 17581 | { | ||
| 17582 | 18 | screens_to_read=MAPSCRS192b136; | |
| 17583 | 18 | } | |
| 17584 | else | ||
| 17585 | { | ||
| 17586 | 479 | screens_to_read=MAPSCRS; | |
| 17587 | } | ||
| 17588 | |||
| 17589 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 24 times.
|
497 | if(Header->zelda_version > 0x192) |
| 17590 | { | ||
| 17591 | //section version info | ||
| 17592 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 473 times.
✗ Branch 3 not taken.
|
473 | if(!p_igetw(&version,f)) |
| 17593 | { | ||
| 17594 | ✗ | return qe_invalid; | |
| 17595 | } | ||
| 17596 | |||
| 17597 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if (version > V_MAPS) |
| 17598 | ✗ | return qe_version; | |
| 17599 | |||
| 17600 | 473 | FFCore.quest_format[vMaps] = version; | |
| 17601 | |||
| 17602 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 473 times.
✗ Branch 3 not taken.
|
473 | if(!p_igetw(&dummy,f)) |
| 17603 | { | ||
| 17604 | ✗ | return qe_invalid; | |
| 17605 | } | ||
| 17606 | |||
| 17607 | //section size | ||
| 17608 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 473 times.
✗ Branch 3 not taken.
|
473 | if(!p_igetl(§ion_size,f)) |
| 17609 | { | ||
| 17610 | ✗ | return qe_invalid; | |
| 17611 | } | ||
| 17612 | |||
| 17613 | //finally... section data | ||
| 17614 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 473 times.
✗ Branch 3 not taken.
|
473 | if(!p_igetw(&temp_map_count,f)) |
| 17615 | { | ||
| 17616 | ✗ | return 5; | |
| 17617 | } | ||
| 17618 | 473 | } | |
| 17619 | else | ||
| 17620 | { | ||
| 17621 | 24 | temp_map_count=map_count; | |
| 17622 | } | ||
| 17623 | |||
| 17624 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 497 times.
|
497 | if (temp_map_count > MAXMAPS) |
| 17625 | { | ||
| 17626 | ✗ | return qe_invalid; | |
| 17627 | } | ||
| 17628 | |||
| 17629 |
2/2✓ Branch 0 taken 496 times.
✓ Branch 1 taken 1 times.
|
497 | if (!should_skip) |
| 17630 | { | ||
| 17631 | 496 | const int32_t _mapsSize = MAPSCRS*temp_map_count; | |
| 17632 | 496 | TheMaps.clear(); | |
| 17633 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | TheMaps.resize(_mapsSize); |
| 17634 | 496 | old_combo_pages.clear(); | |
| 17635 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | old_combo_pages.resize(_mapsSize); |
| 17636 | 496 | map_infos.clear(); | |
| 17637 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | map_infos.resize(temp_map_count); |
| 17638 |
2/2✓ Branch 0 taken 327 times.
✓ Branch 1 taken 169 times.
|
496 | if(version >= 31) |
| 17639 | 169 | Regions = {}; | |
| 17640 | 496 | } | |
| 17641 | |||
| 17642 |
4/4✓ Branch 0 taken 497 times.
✓ Branch 1 taken 12849 times.
✓ Branch 2 taken 12849 times.
✓ Branch 3 taken 497 times.
|
13346 | for(int32_t i=0; i<temp_map_count && i<MAXMAPS; i++) |
| 17643 | { | ||
| 17644 | 12849 | byte valid=1; | |
| 17645 |
2/2✓ Branch 0 taken 4238 times.
✓ Branch 1 taken 8611 times.
|
12849 | if(version > 22) |
| 17646 | { | ||
| 17647 |
2/4✓ Branch 0 taken 4238 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4238 times.
✗ Branch 3 not taken.
|
4238 | if(!p_getc(&valid,f)) |
| 17648 | ✗ | return qe_invalid; | |
| 17649 | 4238 | } | |
| 17650 |
2/2✓ Branch 0 taken 1413 times.
✓ Branch 1 taken 11436 times.
|
12849 | if(valid) |
| 17651 | { | ||
| 17652 |
2/2✓ Branch 0 taken 8741 times.
✓ Branch 1 taken 2695 times.
|
11436 | if (version > 25) |
| 17653 | { | ||
| 17654 | 2695 | auto& mapinf = map_infos[i]; | |
| 17655 |
2/2✓ Branch 0 taken 16170 times.
✓ Branch 1 taken 2695 times.
|
18865 | for(int q = 0; q < 6; ++q) |
| 17656 | { | ||
| 17657 |
2/4✓ Branch 0 taken 16170 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16170 times.
✗ Branch 3 not taken.
|
16170 | if(!p_igetw(&mapinf.autolayers[q],f)) |
| 17658 | ✗ | return qe_invalid; | |
| 17659 | 16170 | } | |
| 17660 |
2/2✓ Branch 0 taken 948 times.
✓ Branch 1 taken 1747 times.
|
2695 | if (version >= 36) |
| 17661 |
2/4✓ Branch 0 taken 948 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 948 times.
✗ Branch 3 not taken.
|
948 | if(!p_igetw(&mapinf.autopalette,f)) |
| 17662 | ✗ | return qe_invalid; | |
| 17663 | 2695 | } | |
| 17664 | |||
| 17665 |
2/2✓ Branch 0 taken 9200 times.
✓ Branch 1 taken 2236 times.
|
11436 | if (version >= 31) |
| 17666 | { | ||
| 17667 | static regions_data tmp_rd; | ||
| 17668 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2236 times.
|
2236 | regions_data& rd = should_skip ? tmp_rd : Regions[i]; |
| 17669 |
2/2✓ Branch 0 taken 17888 times.
✓ Branch 1 taken 2236 times.
|
20124 | for(int32_t j=0; j<8; j++) |
| 17670 | { | ||
| 17671 |
2/2✓ Branch 0 taken 143104 times.
✓ Branch 1 taken 17888 times.
|
160992 | for(int32_t k=0; k<8; k++) |
| 17672 | { | ||
| 17673 |
2/4✓ Branch 0 taken 143104 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 143104 times.
✗ Branch 3 not taken.
|
143104 | if(!p_getc(&rd.region_ids[j][k],f)) |
| 17674 | { | ||
| 17675 | ✗ | return qe_invalid; | |
| 17676 | } | ||
| 17677 | 143104 | } | |
| 17678 | 17888 | } | |
| 17679 | 2236 | } | |
| 17680 | 11436 | } | |
| 17681 |
2/2✓ Branch 0 taken 1746792 times.
✓ Branch 1 taken 12849 times.
|
1759641 | for(int32_t j=0; j<screens_to_read; j++) |
| 17682 | { | ||
| 17683 | 1746792 | screen=i*MAPSCRS+j; | |
| 17684 |
2/2✓ Branch 0 taken 272 times.
✓ Branch 1 taken 1746520 times.
|
1746792 | mapscr* scr = should_skip ? &temp_mapscr : &TheMaps[screen]; |
| 17685 | 1746792 | scr->map = i; | |
| 17686 | 1746792 | scr->screen = j; | |
| 17687 |
2/2✓ Branch 0 taken 1554624 times.
✓ Branch 1 taken 192168 times.
|
1746792 | if(valid) |
| 17688 |
1/2✓ Branch 0 taken 1554624 times.
✗ Branch 1 not taken.
|
1554624 | readmapscreen(f, Header, scr, version, screen, !should_skip); |
| 17689 |
1/2✓ Branch 0 taken 192168 times.
✗ Branch 1 not taken.
|
192168 | else if (!should_skip) |
| 17690 |
1/2✓ Branch 0 taken 192168 times.
✗ Branch 1 not taken.
|
192168 | clear_screen(scr); |
| 17691 | 1746792 | } | |
| 17692 | |||
| 17693 |
2/2✓ Branch 0 taken 12847 times.
✓ Branch 1 taken 2 times.
|
12849 | if (should_skip) |
| 17694 | 2 | continue; | |
| 17695 | |||
| 17696 |
5/6✓ Branch 0 taken 12679 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 12661 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 18 times.
|
12847 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 17697 | { | ||
| 17698 | 168 | int32_t index = (i*MAPSCRS+132); | |
| 17699 | |||
| 17700 |
1/2✓ Branch 0 taken 168 times.
✗ Branch 1 not taken.
|
168 | TheMaps[index]=TheMaps[index-1]; |
| 17701 | |||
| 17702 | 168 | MEMCPY_ARR(TheMaps[i*MAPSCRS+132].data, TheMaps[i*MAPSCRS+131].data); | |
| 17703 | 168 | MEMCPY_ARR(TheMaps[i*MAPSCRS+132].sflag, TheMaps[i*MAPSCRS+131].sflag); | |
| 17704 | 168 | MEMCPY_ARR(TheMaps[i*MAPSCRS+132].cset, TheMaps[i*MAPSCRS+131].cset); | |
| 17705 | |||
| 17706 |
2/2✓ Branch 0 taken 504 times.
✓ Branch 1 taken 168 times.
|
672 | for(int32_t j=133; j<MAPSCRS; j++) |
| 17707 | { | ||
| 17708 | 504 | screen=i*MAPSCRS+j; | |
| 17709 | |||
| 17710 |
1/2✓ Branch 0 taken 504 times.
✗ Branch 1 not taken.
|
504 | TheMaps[screen].zero_memory(); |
| 17711 | 504 | TheMaps[screen].valid = mVERSION; | |
| 17712 | 504 | TheMaps[screen].music = -1; | |
| 17713 | 504 | TheMaps[screen].csensitive = 1; | |
| 17714 | 504 | } | |
| 17715 | 168 | } | |
| 17716 | |||
| 17717 |
5/6✓ Branch 0 taken 12679 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 12661 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 18 times.
|
12847 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 17718 | { | ||
| 17719 |
2/2✓ Branch 0 taken 22848 times.
✓ Branch 1 taken 168 times.
|
23016 | for(int32_t j=0; j<MAPSCRS; j++) |
| 17720 | { | ||
| 17721 | 22848 | screen=i*MAPSCRS+j; | |
| 17722 |
1/2✓ Branch 0 taken 22848 times.
✗ Branch 1 not taken.
|
22848 | TheMaps[screen].door_combo_set=MakeDoors(i, j); |
| 17723 | |||
| 17724 |
2/2✓ Branch 0 taken 2924544 times.
✓ Branch 1 taken 22848 times.
|
2947392 | for(int32_t k=0; k<128; k++) |
| 17725 | { | ||
| 17726 |
1/2✓ Branch 0 taken 2924544 times.
✗ Branch 1 not taken.
|
2924544 | TheMaps[screen].secretcset[k]=tcmbcset2(i, TheMaps[screen].secretcombo[k]); |
| 17727 |
1/2✓ Branch 0 taken 2924544 times.
✗ Branch 1 not taken.
|
2924544 | TheMaps[screen].secretflag[k]=tcmbflag2(i, TheMaps[screen].secretcombo[k]); |
| 17728 |
1/2✓ Branch 0 taken 2924544 times.
✗ Branch 1 not taken.
|
2924544 | TheMaps[screen].secretcombo[k]=tcmbdat2(i, j, TheMaps[screen].secretcombo[k]); |
| 17729 | 2924544 | } | |
| 17730 | 22848 | } | |
| 17731 | 168 | } | |
| 17732 | 12847 | } | |
| 17733 | 497 | map_count = temp_map_count; | |
| 17734 | 497 | return 0; | |
| 17735 | 497 | } | |
| 17736 | |||
| 17737 | |||
| 17738 | 9186847 | void update_combo(newcombo& cmb, word section_version) | |
| 17739 | { | ||
| 17740 |
2/2✓ Branch 0 taken 1555788 times.
✓ Branch 1 taken 7631059 times.
|
9186847 | if(section_version < 40) |
| 17741 | { | ||
| 17742 |
3/3✓ Branch 0 taken 5139 times.
✓ Branch 1 taken 44969 times.
✓ Branch 2 taken 7580951 times.
|
7631059 | switch(cmb.type) |
| 17743 | { | ||
| 17744 | case cWATER: case cSHALLOWWATER: | ||
| 17745 | 44969 | cmb.c_attributes[8 + 6] = iwRipples; | |
| 17746 | 44969 | break; | |
| 17747 | case cTALLGRASS: case cTALLGRASSNEXT: case cTALLGRASSTOUCHY: | ||
| 17748 | 5139 | cmb.c_attributes[8 + 6] = iwTallGrass; | |
| 17749 | 5139 | break; | |
| 17750 | } | ||
| 17751 | 7631059 | } | |
| 17752 |
2/2✓ Branch 0 taken 1205450 times.
✓ Branch 1 taken 7981397 times.
|
9186847 | if(section_version < 49) |
| 17753 | { | ||
| 17754 |
4/4✓ Branch 0 taken 7946930 times.
✓ Branch 1 taken 34467 times.
✓ Branch 2 taken 15379 times.
✓ Branch 3 taken 7931551 times.
|
7981397 | if(cmb.type == cWATER || cmb.type == cSHALLOWWATER) |
| 17755 | 49846 | cmb.sfx_landing = WAV_ZN1SPLASH; | |
| 17756 | 7981397 | } | |
| 17757 | 9186847 | } | |
| 17758 | 287 | int32_t readcombos_old(word section_version, PACKFILE *f, zquestheader *, word version, word build, word start_combo, word max_combos) | |
| 17759 | { | ||
| 17760 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 263 times.
|
287 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_combos); |
| 17761 | byte tempbyte; | ||
| 17762 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 286 times.
|
287 | if (!should_skip) |
| 17763 | { | ||
| 17764 | 286 | reset_all_combo_animations(); | |
| 17765 | 286 | init_combo_classes(); | |
| 17766 | 286 | } | |
| 17767 | |||
| 17768 | // combos | ||
| 17769 | 287 | word combos_used=0; | |
| 17770 | int32_t dummy; | ||
| 17771 | byte padding; | ||
| 17772 | word wpadding; | ||
| 17773 | 287 | newcombo temp_combo; | |
| 17774 | |||
| 17775 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 286 times.
|
287 | if (!should_skip) |
| 17776 |
2/2✓ Branch 0 taken 18670080 times.
✓ Branch 1 taken 286 times.
|
18670366 | for(int32_t q = start_combo; q < start_combo+max_combos; ++q) |
| 17777 |
1/2✓ Branch 0 taken 18670080 times.
✗ Branch 1 not taken.
|
18670366 | combobuf[q].clear(); |
| 17778 | |||
| 17779 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 287 times.
|
287 | if(version < 0x174) |
| 17780 | { | ||
| 17781 | ✗ | combos_used=1024; | |
| 17782 | ✗ | } | |
| 17783 |
2/2✓ Branch 0 taken 269 times.
✓ Branch 1 taken 18 times.
|
287 | else if(version < 0x191) |
| 17784 | { | ||
| 17785 | 18 | combos_used=2048; | |
| 17786 | 18 | } | |
| 17787 | else | ||
| 17788 | { | ||
| 17789 |
2/4✓ Branch 0 taken 269 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 269 times.
✗ Branch 3 not taken.
|
269 | if(!p_igetw(&combos_used,f)) |
| 17790 | { | ||
| 17791 | ✗ | return qe_invalid; | |
| 17792 | } | ||
| 17793 | } | ||
| 17794 | |||
| 17795 | //finally... section data | ||
| 17796 |
2/2✓ Branch 0 taken 7496043 times.
✓ Branch 1 taken 287 times.
|
7496330 | for(int32_t i=0; i<combos_used; i++) |
| 17797 | { | ||
| 17798 |
1/2✓ Branch 0 taken 7496043 times.
✗ Branch 1 not taken.
|
7496043 | temp_combo.clear(); |
| 17799 |
1/2✓ Branch 0 taken 7496043 times.
✗ Branch 1 not taken.
|
7496043 | combo_trigger& temp_trigger = temp_combo.triggers.emplace_back(); |
| 17800 | 7496043 | int32_t temp_trigflags[6] = {0}; | |
| 17801 | |||
| 17802 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7293075 times.
|
7496043 | if ( section_version >= 11 ) |
| 17803 | { | ||
| 17804 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_igetl(&temp_combo.tile,f)) |
| 17805 | { | ||
| 17806 | ✗ | return qe_invalid; | |
| 17807 | } | ||
| 17808 | 202968 | } | |
| 17809 | else | ||
| 17810 | { | ||
| 17811 |
2/4✓ Branch 0 taken 7293075 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7293075 times.
✗ Branch 3 not taken.
|
7293075 | if(!p_igetw(&temp_combo.tile,f)) |
| 17812 | { | ||
| 17813 | ✗ | return qe_invalid; | |
| 17814 | } | ||
| 17815 | } | ||
| 17816 | 7496043 | temp_combo.o_tile = temp_combo.tile; | |
| 17817 |
2/4✓ Branch 0 taken 7496043 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7496043 times.
✗ Branch 3 not taken.
|
7496043 | if(!p_getc(&temp_combo.flip,f)) |
| 17818 | { | ||
| 17819 | ✗ | return qe_invalid; | |
| 17820 | } | ||
| 17821 | |||
| 17822 |
2/4✓ Branch 0 taken 7496043 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7496043 times.
✗ Branch 3 not taken.
|
7496043 | if(!p_getc(&temp_combo.walk,f)) |
| 17823 | { | ||
| 17824 | ✗ | return qe_invalid; | |
| 17825 | } | ||
| 17826 | |||
| 17827 |
2/4✓ Branch 0 taken 7496043 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7496043 times.
✗ Branch 3 not taken.
|
7496043 | if(!p_getc(&temp_combo.type,f)) |
| 17828 | { | ||
| 17829 | ✗ | return qe_invalid; | |
| 17830 | } | ||
| 17831 | |||
| 17832 |
2/4✓ Branch 0 taken 7496043 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7496043 times.
✗ Branch 3 not taken.
|
7496043 | if(!p_getc(&temp_combo.csets,f)) |
| 17833 | { | ||
| 17834 | ✗ | return qe_invalid; | |
| 17835 | } | ||
| 17836 | |||
| 17837 |
2/2✓ Branch 0 taken 69774 times.
✓ Branch 1 taken 7426269 times.
|
7496043 | if(version < 0x193) |
| 17838 | { | ||
| 17839 |
2/4✓ Branch 0 taken 69774 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69774 times.
✗ Branch 3 not taken.
|
69774 | if(!p_getc(&padding,f)) |
| 17840 | ✗ | return qe_invalid; | |
| 17841 | |||
| 17842 |
2/4✓ Branch 0 taken 69774 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69774 times.
✗ Branch 3 not taken.
|
69774 | if(!p_getc(&padding,f)) |
| 17843 | ✗ | return qe_invalid; | |
| 17844 | |||
| 17845 |
2/2✓ Branch 0 taken 32910 times.
✓ Branch 1 taken 36864 times.
|
69774 | if(version < 0x192) |
| 17846 | { | ||
| 17847 |
1/2✓ Branch 0 taken 36864 times.
✗ Branch 1 not taken.
|
36864 | if(version == 0x191) |
| 17848 | { | ||
| 17849 | ✗ | for(int32_t tmpcounter=0; tmpcounter<16; tmpcounter++) | |
| 17850 | { | ||
| 17851 | ✗ | if(!p_getc(&padding,f)) | |
| 17852 | ✗ | return qe_invalid; | |
| 17853 | ✗ | } | |
| 17854 | ✗ | } | |
| 17855 | 36864 | } | |
| 17856 | 69774 | } | |
| 17857 |
2/2✓ Branch 0 taken 7459179 times.
✓ Branch 1 taken 36864 times.
|
7496043 | if(version >= 0x192) |
| 17858 | { | ||
| 17859 |
2/4✓ Branch 0 taken 7459179 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7459179 times.
✗ Branch 3 not taken.
|
7459179 | if(!p_getc(&temp_combo.frames,f)) |
| 17860 | ✗ | return qe_invalid; | |
| 17861 | |||
| 17862 |
2/4✓ Branch 0 taken 7459179 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7459179 times.
✗ Branch 3 not taken.
|
7459179 | if(!p_getc(&temp_combo.speed,f)) |
| 17863 | ✗ | return qe_invalid; | |
| 17864 | |||
| 17865 |
2/4✓ Branch 0 taken 7459179 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7459179 times.
✗ Branch 3 not taken.
|
7459179 | if(!p_igetw(&temp_combo.nextcombo,f)) |
| 17866 | ✗ | return qe_invalid; | |
| 17867 | |||
| 17868 |
2/4✓ Branch 0 taken 7459179 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7459179 times.
✗ Branch 3 not taken.
|
7459179 | if(!p_getc(&temp_combo.nextcset,f)) |
| 17869 | ✗ | return qe_invalid; | |
| 17870 | |||
| 17871 | //Base flag | ||
| 17872 |
2/2✓ Branch 0 taken 4621731 times.
✓ Branch 1 taken 2837448 times.
|
7459179 | if(section_version>=3) |
| 17873 |
2/4✓ Branch 0 taken 4621731 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4621731 times.
✗ Branch 3 not taken.
|
4621731 | if(!p_getc(&temp_combo.flag,f)) |
| 17874 | ✗ | return qe_invalid; | |
| 17875 | |||
| 17876 |
2/2✓ Branch 0 taken 4621731 times.
✓ Branch 1 taken 2837448 times.
|
7459179 | if(section_version>=4) |
| 17877 | { | ||
| 17878 |
2/4✓ Branch 0 taken 4621731 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4621731 times.
✗ Branch 3 not taken.
|
4621731 | if(!p_getc(&temp_combo.skipanim,f)) |
| 17879 | ✗ | return qe_invalid; | |
| 17880 | |||
| 17881 |
2/4✓ Branch 0 taken 4621731 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4621731 times.
✗ Branch 3 not taken.
|
4621731 | if(!p_igetw(&temp_combo.nexttimer,f)) |
| 17882 | ✗ | return qe_invalid; | |
| 17883 | 4621731 | } | |
| 17884 | |||
| 17885 |
2/2✓ Branch 0 taken 4621731 times.
✓ Branch 1 taken 2837448 times.
|
7459179 | if(section_version>=5) |
| 17886 |
2/4✓ Branch 0 taken 4621731 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4621731 times.
✗ Branch 3 not taken.
|
4621731 | if(!p_getc(&temp_combo.skipanimy,f)) |
| 17887 | ✗ | return qe_invalid; | |
| 17888 | |||
| 17889 |
2/2✓ Branch 0 taken 4621731 times.
✓ Branch 1 taken 2837448 times.
|
7459179 | if(section_version>=6) |
| 17890 | { | ||
| 17891 |
2/4✓ Branch 0 taken 4621731 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4621731 times.
✗ Branch 3 not taken.
|
4621731 | if(!p_getc(&temp_combo.animflags,f)) |
| 17892 | ✗ | return qe_invalid; | |
| 17893 | |||
| 17894 |
1/2✓ Branch 0 taken 4621731 times.
✗ Branch 1 not taken.
|
4621731 | if(section_version == 6) |
| 17895 | ✗ | temp_combo.animflags = temp_combo.animflags ? AF_FRESH : 0; | |
| 17896 | 4621731 | } | |
| 17897 | |||
| 17898 |
2/2✓ Branch 0 taken 7256211 times.
✓ Branch 1 taken 202968 times.
|
7459179 | if(section_version>=8) //combo Attributes[4] and userflags. |
| 17899 | { | ||
| 17900 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 811872 times.
|
1014840 | for ( int32_t q = 0; q < 4; q++ ) |
| 17901 |
2/4✓ Branch 0 taken 811872 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 811872 times.
✗ Branch 3 not taken.
|
811872 | if(!p_igetzf(&temp_combo.c_attributes[q],f)) |
| 17902 | ✗ | return qe_invalid; | |
| 17903 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_igetl(&temp_combo.usrflags,f)) |
| 17904 | ✗ | return qe_invalid; | |
| 17905 |
1/2✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
|
202968 | if(section_version >= 20) |
| 17906 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_igetw(&temp_combo.genflags,f)) |
| 17907 | ✗ | return qe_invalid; | |
| 17908 | 202968 | } | |
| 17909 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7256211 times.
|
7459179 | if(section_version>=10) //combo trigger flags |
| 17910 | { | ||
| 17911 |
2/2✓ Branch 0 taken 608904 times.
✓ Branch 1 taken 202968 times.
|
811872 | for ( int32_t q = 0; q < 3; q++ ) |
| 17912 |
2/4✓ Branch 0 taken 608904 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 608904 times.
✗ Branch 3 not taken.
|
608904 | if(!p_igetl(&temp_trigflags[q],f)) |
| 17913 | ✗ | return qe_invalid; | |
| 17914 | 202968 | } | |
| 17915 |
1/2✓ Branch 0 taken 7256211 times.
✗ Branch 1 not taken.
|
7256211 | else if(section_version==9) //combo trigger flags, V9 only had two indices |
| 17916 | { | ||
| 17917 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 17918 | ✗ | if(!p_igetl(&temp_trigflags[q],f)) | |
| 17919 | ✗ | return qe_invalid; | |
| 17920 | ✗ | } | |
| 17921 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7256211 times.
|
7459179 | if(section_version >= 9) |
| 17922 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_igetl(&temp_trigger.triggerlevel,f)) |
| 17923 | ✗ | return qe_invalid; | |
| 17924 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7256211 times.
|
7459179 | if(section_version >= 22) |
| 17925 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_getc(&temp_trigger.triggerbtn,f)) |
| 17926 | ✗ | return qe_invalid; | |
| 17927 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7459179 times.
|
7459179 | if(section_version >= 24) |
| 17928 | { | ||
| 17929 | ✗ | if(!p_getc(&temp_trigger.triggeritem,f)) | |
| 17930 | ✗ | return qe_invalid; | |
| 17931 | ✗ | if(!p_getc(&tempbyte, f)) | |
| 17932 | ✗ | return qe_invalid; | |
| 17933 | ✗ | temp_trigger.trigtimer = tempbyte; | |
| 17934 | ✗ | } | |
| 17935 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7459179 times.
|
7459179 | if(section_version >= 25) |
| 17936 | ✗ | if(!p_getc(&temp_trigger.trigsfx,f)) | |
| 17937 | ✗ | return qe_invalid; | |
| 17938 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7459179 times.
|
7459179 | if(section_version >= 27) |
| 17939 | ✗ | if(!p_igetl(&temp_trigger.trigchange,f)) | |
| 17940 | ✗ | return qe_invalid; | |
| 17941 | |||
| 17942 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7459179 times.
|
7459179 | if(section_version >= 29) |
| 17943 | { | ||
| 17944 | ✗ | if(!p_igetw(&temp_trigger.trigprox,f)) | |
| 17945 | ✗ | return qe_invalid; | |
| 17946 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 17947 | ✗ | return qe_invalid; | |
| 17948 | ✗ | temp_trigger.trigctr = tempbyte; | |
| 17949 | ✗ | if(!p_igetl(&temp_trigger.trigctramnt,f)) | |
| 17950 | ✗ | return qe_invalid; | |
| 17951 | ✗ | } | |
| 17952 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7459179 times.
|
7459179 | if(section_version >= 30) |
| 17953 | ✗ | if(!p_getc(&temp_trigger.triglbeam,f)) | |
| 17954 | ✗ | return qe_invalid; | |
| 17955 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7459179 times.
|
7459179 | if(section_version >= 31) |
| 17956 | { | ||
| 17957 | ✗ | if(!p_getc(&temp_trigger.trigcschange,f)) | |
| 17958 | ✗ | return qe_invalid; | |
| 17959 | ✗ | if(!p_igetw(&temp_trigger.spawnitem,f)) | |
| 17960 | ✗ | return qe_invalid; | |
| 17961 | ✗ | if(!p_igetw(&temp_trigger.spawnenemy,f)) | |
| 17962 | ✗ | return qe_invalid; | |
| 17963 | ✗ | if(!p_getc(&temp_trigger.exstate,f)) | |
| 17964 | ✗ | return qe_invalid; | |
| 17965 | ✗ | if(!p_igetl(&temp_trigger.spawnip,f)) | |
| 17966 | ✗ | return qe_invalid; | |
| 17967 | ✗ | if(!p_getc(&temp_trigger.trigcopycat,f)) | |
| 17968 | ✗ | return qe_invalid; | |
| 17969 | ✗ | } | |
| 17970 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7459179 times.
|
7459179 | if(section_version >= 32) |
| 17971 | ✗ | if(!p_getc(&temp_trigger.trigcooldown,f)) | |
| 17972 | ✗ | return qe_invalid; | |
| 17973 | |||
| 17974 |
2/2✓ Branch 0 taken 7256211 times.
✓ Branch 1 taken 202968 times.
|
7459179 | if(section_version>=12) //combo label |
| 17975 | { | ||
| 17976 | char label[12]; | ||
| 17977 | 202968 | label[11] = '\0'; | |
| 17978 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 2232648 times.
|
2435616 | for ( int32_t q = 0; q < 11; q++ ) |
| 17979 |
2/4✓ Branch 0 taken 2232648 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2232648 times.
✗ Branch 3 not taken.
|
2232648 | if(!p_getc(&label[q],f)) |
| 17980 | ✗ | return qe_invalid; | |
| 17981 |
1/2✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
|
202968 | temp_combo.label = label; |
| 17982 | 202968 | } | |
| 17983 |
3/4✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7256211 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 202968 times.
|
7459179 | if(section_version >= 13 && section_version < 63) //attribytes[4] |
| 17984 | { | ||
| 17985 |
2/2✓ Branch 0 taken 811872 times.
✓ Branch 1 taken 202968 times.
|
1014840 | for ( int32_t q = 0; q < 4; q++ ) |
| 17986 | { | ||
| 17987 |
2/4✓ Branch 0 taken 811872 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 811872 times.
✗ Branch 3 not taken.
|
811872 | if(!p_getc(&padding,f)) |
| 17988 | ✗ | return qe_invalid; | |
| 17989 |
1/2✓ Branch 0 taken 811872 times.
✗ Branch 1 not taken.
|
811872 | temp_combo.c_attributes[8 + q] = padding; |
| 17990 | 811872 | } | |
| 17991 | 202968 | } | |
| 17992 | /* HIGHLY UNORTHODOX UPDATING THING, by Deedee | ||
| 17993 | * This fixes a poor implementation of a ->next flag bug thing. | ||
| 17994 | * Zoria didn't bump up the versions as liberally as he should have, but thankfully | ||
| 17995 | * there was a version bump a few weeks before a change that broke stuff. | ||
| 17996 | */ | ||
| 17997 |
3/4✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7256211 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 202968 times.
|
7459179 | if (section_version >= 13 && section_version < 21) |
| 17998 | { | ||
| 17999 | ✗ | set_qr(qr_BUGGY_BUGGY_SLASH_TRIGGERS,1); | |
| 18000 | ✗ | } | |
| 18001 | //combo scripts | ||
| 18002 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7256211 times.
|
7459179 | if(section_version>=14) |
| 18003 | { | ||
| 18004 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_igetw(&temp_combo.script,f)) |
| 18005 | ✗ | return qe_invalid; | |
| 18006 |
2/2✓ Branch 0 taken 405936 times.
✓ Branch 1 taken 202968 times.
|
608904 | for ( int32_t q = 0; q < 2; q++ ) |
| 18007 |
2/4✓ Branch 0 taken 405936 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405936 times.
✗ Branch 3 not taken.
|
405936 | if(!p_igetl(&temp_combo.initd[q],f)) |
| 18008 | ✗ | return qe_invalid; | |
| 18009 | 202968 | } | |
| 18010 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7256211 times.
|
7459179 | if(section_version>=15) |
| 18011 | { | ||
| 18012 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_igetl(&temp_combo.o_tile,f)) return qe_invalid; |
| 18013 |
2/2✓ Branch 0 taken 107633 times.
✓ Branch 1 taken 95335 times.
|
202968 | if(!temp_combo.o_tile) temp_combo.o_tile = temp_combo.tile; |
| 18014 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_getc(&temp_combo.cur_frame,f)) return qe_invalid; |
| 18015 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_getc(&temp_combo.aclk,f)) return qe_invalid; |
| 18016 | 202968 | } | |
| 18017 |
3/4✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7256211 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 202968 times.
|
7459179 | if(section_version >= 17 && section_version < 63) //attribytes[4] |
| 18018 | { | ||
| 18019 |
2/2✓ Branch 0 taken 811872 times.
✓ Branch 1 taken 202968 times.
|
1014840 | for ( int32_t q = 4; q < 8; q++ ) //bump up attribytes... |
| 18020 | { | ||
| 18021 |
2/4✓ Branch 0 taken 811872 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 811872 times.
✗ Branch 3 not taken.
|
811872 | if(!p_getc(&padding,f)) |
| 18022 | ✗ | return qe_invalid; | |
| 18023 |
1/2✓ Branch 0 taken 811872 times.
✗ Branch 1 not taken.
|
811872 | temp_combo.c_attributes[8 + q] = padding; |
| 18024 | 811872 | } | |
| 18025 |
2/2✓ Branch 0 taken 1623744 times.
✓ Branch 1 taken 202968 times.
|
1826712 | for ( int32_t q = 0; q < 8; q++ ) //...and add attrishorts |
| 18026 | { | ||
| 18027 |
2/4✓ Branch 0 taken 1623744 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1623744 times.
✗ Branch 3 not taken.
|
1623744 | if(!p_igetw(&wpadding,f)) |
| 18028 | ✗ | return qe_invalid; | |
| 18029 |
1/2✓ Branch 0 taken 1623744 times.
✗ Branch 1 not taken.
|
1623744 | temp_combo.c_attributes[16 + q] = int16_t(wpadding); |
| 18030 | 1623744 | } | |
| 18031 | 202968 | } | |
| 18032 | |||
| 18033 |
2/2✓ Branch 0 taken 7426269 times.
✓ Branch 1 taken 32910 times.
|
7459179 | if(version < 0x193) |
| 18034 |
2/2✓ Branch 0 taken 362010 times.
✓ Branch 1 taken 32910 times.
|
394920 | for(int32_t q=0; q<11; q++) |
| 18035 |
2/4✓ Branch 0 taken 362010 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 362010 times.
✗ Branch 3 not taken.
|
362010 | if(!p_getc(&dummy,f)) |
| 18036 | 32910 | return qe_invalid; | |
| 18037 | 7459179 | } | |
| 18038 | |||
| 18039 | //Goriya tiles were flipped around in 2.11 build 7. Compensate for the flip here. -DD | ||
| 18040 |
3/6✓ Branch 0 taken 4621731 times.
✓ Branch 1 taken 2874312 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4621731 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
7496043 | if((version < 0x211)||((version == 0x211)&&(build<7))) |
| 18041 | { | ||
| 18042 |
2/2✓ Branch 0 taken 2834376 times.
✓ Branch 1 taken 39936 times.
|
2874312 | if(!get_qr(qr_NEWENEMYTILES)) |
| 18043 | { | ||
| 18044 |
1/5✓ Branch 0 taken 39936 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
39936 | switch(temp_combo.tile) |
| 18045 | { | ||
| 18046 | case 130: | ||
| 18047 | ✗ | temp_combo.tile = 132; | |
| 18048 | ✗ | break; | |
| 18049 | |||
| 18050 | case 131: | ||
| 18051 | ✗ | temp_combo.tile = 133; | |
| 18052 | ✗ | break; | |
| 18053 | |||
| 18054 | case 132: | ||
| 18055 | ✗ | temp_combo.tile = 130; | |
| 18056 | ✗ | break; | |
| 18057 | |||
| 18058 | case 133: | ||
| 18059 | ✗ | temp_combo.tile = 131; | |
| 18060 | ✗ | break; | |
| 18061 | } | ||
| 18062 | 39936 | } | |
| 18063 | 2874312 | } | |
| 18064 | |||
| 18065 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7293075 times.
|
7496043 | if(section_version < 15) |
| 18066 | 7293075 | temp_combo.o_tile = temp_combo.tile; | |
| 18067 | |||
| 18068 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7293075 times.
|
7496043 | if(section_version<18) //upper bits for .walk |
| 18069 | 7293075 | temp_combo.walk |= 0xF0; | |
| 18070 | |||
| 18071 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7293075 times.
|
7496043 | if(section_version < 19) |
| 18072 |
2/2✓ Branch 0 taken 29172300 times.
✓ Branch 1 taken 7293075 times.
|
36465375 | for(int32_t q = 0; q < 4; ++q) |
| 18073 |
1/2✓ Branch 0 taken 29172300 times.
✗ Branch 1 not taken.
|
36465375 | temp_combo.c_attributes[q] *= 10000; |
| 18074 | |||
| 18075 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7496043 times.
|
7496043 | if(section_version < 23) |
| 18076 | { | ||
| 18077 |
2/2✓ Branch 0 taken 15235 times.
✓ Branch 1 taken 7480808 times.
|
7496043 | switch(temp_combo.type) //TRIGFLAG_CMBTYPEFX now required for combotype-specific effects |
| 18078 | { | ||
| 18079 | case cSCRIPT1: case cSCRIPT2: case cSCRIPT3: case cSCRIPT4: case cSCRIPT5: | ||
| 18080 | case cSCRIPT6: case cSCRIPT7: case cSCRIPT8: case cSCRIPT9: case cSCRIPT10: | ||
| 18081 | case cTRIGGERGENERIC: case cCSWITCH: | ||
| 18082 | 15235 | temp_trigflags[TRIGFLAG_CMBTYPEFX/32] |= 1<<(TRIGFLAG_CMBTYPEFX%32); | |
| 18083 | 15235 | } | |
| 18084 | 7496043 | } | |
| 18085 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7496043 times.
|
7496043 | if(section_version < 25) |
| 18086 | { | ||
| 18087 |
2/2✓ Branch 0 taken 27337 times.
✓ Branch 1 taken 7468706 times.
|
7496043 | switch(temp_combo.type) |
| 18088 | { | ||
| 18089 | case cLOCKBLOCK: case cBOSSLOCKBLOCK: | ||
| 18090 |
1/2✓ Branch 0 taken 27337 times.
✗ Branch 1 not taken.
|
27337 | if(!(temp_combo.usrflags & cflag3)) |
| 18091 |
1/2✓ Branch 0 taken 27337 times.
✗ Branch 1 not taken.
|
27337 | temp_combo.c_attributes[8 + 3] = WAV_DOOR; |
| 18092 | 27337 | temp_combo.usrflags &= ~cflag3; | |
| 18093 | 27337 | break; | |
| 18094 | } | ||
| 18095 | 7496043 | } | |
| 18096 | |||
| 18097 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7496043 times.
|
7496043 | if(section_version < 26) |
| 18098 |
2/2✓ Branch 0 taken 7494930 times.
✓ Branch 1 taken 1113 times.
|
7497156 | if(temp_combo.type == cARMOS) |
| 18099 |
1/2✓ Branch 0 taken 1113 times.
✗ Branch 1 not taken.
|
1113 | if(temp_combo.usrflags & cflag1) |
| 18100 | ✗ | temp_combo.usrflags |= cflag3; | |
| 18101 | |||
| 18102 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7496043 times.
|
7496043 | if(section_version < 27) |
| 18103 | { | ||
| 18104 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7496043 times.
|
7496043 | if(temp_trigflags[0] & 0x00040000) //'next' |
| 18105 | ✗ | temp_trigger.trigchange = 1; | |
| 18106 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7496043 times.
|
7496043 | else if(temp_trigflags[0] & 0x00080000) //'prev' |
| 18107 | ✗ | temp_trigger.trigchange = -1; | |
| 18108 | 7496043 | else temp_trigger.trigchange = 0; | |
| 18109 | 7496043 | temp_trigflags[0] &= ~(0x00040000|0x00080000); | |
| 18110 | 7496043 | } | |
| 18111 |
1/2✓ Branch 0 taken 7496043 times.
✗ Branch 1 not taken.
|
7496043 | if(section_version < 28) |
| 18112 | { | ||
| 18113 |
2/2✓ Branch 0 taken 15472 times.
✓ Branch 1 taken 7480571 times.
|
7496043 | switch(temp_combo.type) |
| 18114 | { | ||
| 18115 | case cLOCKBLOCK: case cLOCKEDCHEST: | ||
| 18116 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15472 times.
|
15472 | if(temp_combo.usrflags & cflag7) |
| 18117 | ✗ | temp_combo.usrflags |= cflag8; | |
| 18118 | 15472 | else temp_combo.usrflags &= ~cflag8; | |
| 18119 | 15472 | temp_combo.usrflags &= ~cflag7; | |
| 18120 | 15472 | break; | |
| 18121 | } | ||
| 18122 |
2/2✓ Branch 0 taken 758 times.
✓ Branch 1 taken 7495285 times.
|
7496043 | switch(temp_combo.type) |
| 18123 | { | ||
| 18124 | case cCHEST: case cLOCKEDCHEST: case cBOSSCHEST: | ||
| 18125 |
1/2✓ Branch 0 taken 758 times.
✗ Branch 1 not taken.
|
758 | temp_combo.c_attributes[16 + 2] = -1; |
| 18126 | 758 | temp_combo.usrflags |= cflag7; | |
| 18127 | 758 | break; | |
| 18128 | } | ||
| 18129 | 7496043 | } | |
| 18130 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7293075 times.
|
7496043 | if(section_version < 20) |
| 18131 | { | ||
| 18132 | 7293075 | temp_combo.genflags = 0; | |
| 18133 |
2/2✓ Branch 0 taken 143735 times.
✓ Branch 1 taken 7149340 times.
|
7293075 | switch(temp_combo.type) |
| 18134 | { | ||
| 18135 | case cPUSH_WAIT: case cPUSH_HEAVY: | ||
| 18136 | case cPUSH_HW: case cL_STATUE: | ||
| 18137 | case cR_STATUE: case cPUSH_HEAVY2: | ||
| 18138 | case cPUSH_HW2: case cPOUND: | ||
| 18139 | case cC_STATUE: case cMIRROR: | ||
| 18140 | case cMIRRORSLASH: case cMIRRORBACKSLASH: | ||
| 18141 | case cMAGICPRISM: case cMAGICPRISM4: | ||
| 18142 | case cMAGICSPONGE: case cEYEBALL_A: | ||
| 18143 | case cEYEBALL_B: case cEYEBALL_4: | ||
| 18144 | case cBUSH: case cFLOWERS: | ||
| 18145 | case cLOCKBLOCK: case cLOCKBLOCK2: | ||
| 18146 | case cBOSSLOCKBLOCK: case cBOSSLOCKBLOCK2: | ||
| 18147 | case cCHEST: case cCHEST2: | ||
| 18148 | case cLOCKEDCHEST: case cLOCKEDCHEST2: | ||
| 18149 | case cBOSSCHEST: case cBOSSCHEST2: | ||
| 18150 | case cBUSHNEXT: case cBUSHTOUCHY: | ||
| 18151 | case cFLOWERSTOUCHY: case cBUSHNEXTTOUCHY: | ||
| 18152 | case cSIGNPOST: case cCSWITCHBLOCK: | ||
| 18153 | case cTORCH: case cTRIGGERGENERIC: | ||
| 18154 |
1/2✓ Branch 0 taken 143735 times.
✗ Branch 1 not taken.
|
143735 | if(temp_combo.usrflags & cflag16) |
| 18155 | { | ||
| 18156 | ✗ | temp_combo.genflags |= cflag1; | |
| 18157 | ✗ | temp_combo.usrflags &= ~cflag16; | |
| 18158 | ✗ | } | |
| 18159 | 143735 | break; | |
| 18160 | } | ||
| 18161 | 7293075 | } | |
| 18162 | |||
| 18163 |
1/2✓ Branch 0 taken 7496043 times.
✗ Branch 1 not taken.
|
7496043 | temp_trigger.trigger_flags.clear(); |
| 18164 |
2/2✓ Branch 0 taken 7496043 times.
✓ Branch 1 taken 1439240256 times.
|
1446736299 | for(size_t q = 0; q < 32*6; ++q) |
| 18165 | { | ||
| 18166 | 1439240256 | auto ind = q/32; | |
| 18167 | 1439240256 | auto bit = 1<<(q%32); | |
| 18168 |
2/2✓ Branch 0 taken 1439223980 times.
✓ Branch 1 taken 16276 times.
|
1439240256 | if(temp_trigflags[ind] & bit) |
| 18169 |
1/2✓ Branch 0 taken 16276 times.
✗ Branch 1 not taken.
|
16276 | temp_trigger.trigger_flags.set(q, true); |
| 18170 | 1439240256 | } | |
| 18171 | |||
| 18172 |
3/4✓ Branch 0 taken 7496043 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15274 times.
✓ Branch 3 taken 7480769 times.
|
7496043 | if(temp_trigger.is_blank()) |
| 18173 | 7480769 | temp_combo.triggers.clear(); | |
| 18174 | |||
| 18175 |
1/2✓ Branch 0 taken 7496043 times.
✗ Branch 1 not taken.
|
7496043 | update_combo(temp_combo, section_version); |
| 18176 | |||
| 18177 |
3/4✓ Branch 0 taken 7496043 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7481124 times.
✓ Branch 3 taken 14919 times.
|
7496043 | if(i>=start_combo && !should_skip) |
| 18178 | { | ||
| 18179 |
1/2✓ Branch 0 taken 7481124 times.
✗ Branch 1 not taken.
|
7481124 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 18180 | { | ||
| 18181 | ✗ | temp_combo.script = 0; | |
| 18182 | ✗ | for(int q = 0; q < 8; ++q) | |
| 18183 | ✗ | temp_combo.initd[q] = 0; | |
| 18184 | ✗ | } | |
| 18185 |
1/2✓ Branch 0 taken 7481124 times.
✗ Branch 1 not taken.
|
7481124 | combobuf[i] = temp_combo; |
| 18186 | 7481124 | } | |
| 18187 | 7496043 | } | |
| 18188 | |||
| 18189 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 1 times.
|
287 | if (should_skip) |
| 18190 | 1 | return 0; | |
| 18191 | |||
| 18192 |
5/6✓ Branch 0 taken 268 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 263 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
286 | if((version < 0x192)|| ((version == 0x192)&&(build<185))) |
| 18193 | { | ||
| 18194 |
2/2✓ Branch 0 taken 1501440 times.
✓ Branch 1 taken 23 times.
|
1501463 | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) |
| 18195 | { | ||
| 18196 |
2/2✓ Branch 0 taken 1501225 times.
✓ Branch 1 taken 215 times.
|
1501440 | if(combobuf[tmpcounter].type==cHOOKSHOTONLY) |
| 18197 | { | ||
| 18198 | 215 | combobuf[tmpcounter].type=cLADDERHOOKSHOT; | |
| 18199 | 215 | } | |
| 18200 | 1501440 | } | |
| 18201 | 23 | } | |
| 18202 | |||
| 18203 | //June 3 2012; ladder only is broken in 2.10 and allows the hookshot also. -Gleeok | ||
| 18204 |
4/6✓ Branch 0 taken 58 times.
✓ Branch 1 taken 228 times.
✓ Branch 2 taken 58 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 58 times.
|
286 | if(version == 0x210 && get_app_id() != App::zquest) |
| 18205 | { | ||
| 18206 |
2/2✓ Branch 0 taken 3786240 times.
✓ Branch 1 taken 58 times.
|
3786298 | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) |
| 18207 |
2/2✓ Branch 0 taken 3786056 times.
✓ Branch 1 taken 184 times.
|
3786424 | if(combobuf[tmpcounter].type == cLADDERONLY) |
| 18208 | 184 | combobuf[tmpcounter].type = cLADDERHOOKSHOT; | |
| 18209 | 58 | } | |
| 18210 | |||
| 18211 |
2/2✓ Branch 0 taken 205 times.
✓ Branch 1 taken 81 times.
|
286 | if(section_version<7) |
| 18212 | { | ||
| 18213 |
2/2✓ Branch 0 taken 5287680 times.
✓ Branch 1 taken 81 times.
|
5287761 | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) |
| 18214 | { | ||
| 18215 |
6/9✓ Branch 0 taken 826 times.
✓ Branch 1 taken 775 times.
✓ Branch 2 taken 589 times.
✓ Branch 3 taken 169 times.
✓ Branch 4 taken 526 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 5284795 times.
|
5287680 | switch(combobuf[tmpcounter].type) |
| 18216 | { | ||
| 18217 | case cSLASH: | ||
| 18218 | 826 | combobuf[tmpcounter].type=cSLASHTOUCHY; | |
| 18219 | 826 | break; | |
| 18220 | |||
| 18221 | case cSLASHITEM: | ||
| 18222 | 775 | combobuf[tmpcounter].type=cSLASHITEMTOUCHY; | |
| 18223 | 775 | break; | |
| 18224 | |||
| 18225 | case cBUSH: | ||
| 18226 | 589 | combobuf[tmpcounter].type=cBUSHTOUCHY; | |
| 18227 | 589 | break; | |
| 18228 | |||
| 18229 | case cFLOWERS: | ||
| 18230 | 169 | combobuf[tmpcounter].type=cFLOWERSTOUCHY; | |
| 18231 | 169 | break; | |
| 18232 | |||
| 18233 | case cTALLGRASS: | ||
| 18234 | 526 | combobuf[tmpcounter].type=cTALLGRASSTOUCHY; | |
| 18235 | 526 | break; | |
| 18236 | |||
| 18237 | case cSLASHNEXT: | ||
| 18238 | ✗ | combobuf[tmpcounter].type=cSLASHNEXTTOUCHY; | |
| 18239 | ✗ | break; | |
| 18240 | |||
| 18241 | case cSLASHNEXTITEM: | ||
| 18242 | ✗ | combobuf[tmpcounter].type=cSLASHNEXTITEMTOUCHY; | |
| 18243 | ✗ | break; | |
| 18244 | |||
| 18245 | case cBUSHNEXT: | ||
| 18246 | ✗ | combobuf[tmpcounter].type=cBUSHNEXTTOUCHY; | |
| 18247 | ✗ | break; | |
| 18248 | } | ||
| 18249 | 5287680 | } | |
| 18250 | 81 | } | |
| 18251 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 281 times.
|
286 | if (section_version < 16) |
| 18252 | { | ||
| 18253 |
2/2✓ Branch 0 taken 18343680 times.
✓ Branch 1 taken 281 times.
|
18343961 | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) |
| 18254 | { | ||
| 18255 |
2/2✓ Branch 0 taken 18315180 times.
✓ Branch 1 taken 28500 times.
|
18343680 | if (combobuf[tmpcounter].type == cWATER) |
| 18256 | { | ||
| 18257 |
1/2✓ Branch 0 taken 28500 times.
✗ Branch 1 not taken.
|
28500 | combobuf[tmpcounter].c_attributes[0] = 4; |
| 18258 | 28500 | } | |
| 18259 | 18343680 | } | |
| 18260 | 281 | } | |
| 18261 |
2/2✓ Branch 0 taken 283 times.
✓ Branch 1 taken 3 times.
|
286 | if(!get_qr(qr_ALLOW_EDITING_COMBO_0)) |
| 18262 | { | ||
| 18263 | 3 | combobuf[0].walk = 0xF0; | |
| 18264 | 3 | combobuf[0].type = 0; | |
| 18265 | 3 | combobuf[0].flag = 0; | |
| 18266 | 3 | } | |
| 18267 | |||
| 18268 | //Now for the new combo alias reset | ||
| 18269 |
2/2✓ Branch 0 taken 205 times.
✓ Branch 1 taken 81 times.
|
286 | if(section_version<2) |
| 18270 | { | ||
| 18271 |
2/2✓ Branch 0 taken 663552 times.
✓ Branch 1 taken 81 times.
|
663633 | for(int32_t j=0; j<MAXCOMBOALIASES; j++) |
| 18272 | { | ||
| 18273 | 663552 | combo_aliases[j].width = 0; | |
| 18274 | 663552 | combo_aliases[j].height = 0; | |
| 18275 | 663552 | combo_aliases[j].layermask = 0; | |
| 18276 |
1/2✓ Branch 0 taken 663552 times.
✗ Branch 1 not taken.
|
663552 | combo_aliases[j].combos.clear(); |
| 18277 |
1/2✓ Branch 0 taken 663552 times.
✗ Branch 1 not taken.
|
663552 | combo_aliases[j].csets.clear(); |
| 18278 | 663552 | } | |
| 18279 | 81 | } | |
| 18280 | |||
| 18281 | |||
| 18282 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | setup_combo_animations(); |
| 18283 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | setup_combo_animations2(); |
| 18284 | 286 | return 0; | |
| 18285 | 287 | } | |
| 18286 | |||
| 18287 | 16759 | int32_t readcombo_triggers_loop(PACKFILE* f, word s_version, combo_trigger& temp_trigger) | |
| 18288 | { | ||
| 18289 | byte tempbyte; | ||
| 18290 |
2/2✓ Branch 0 taken 7533 times.
✓ Branch 1 taken 9226 times.
|
16759 | if(s_version >= 52) |
| 18291 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_getcstr(&temp_trigger.label,f)) |
| 18292 | ✗ | return qe_invalid; | |
| 18293 | |||
| 18294 |
2/2✓ Branch 0 taken 7779 times.
✓ Branch 1 taken 8980 times.
|
16759 | if(s_version < 57) |
| 18295 | { | ||
| 18296 | 7779 | int32_t temp_trigflags[6] = {0}; | |
| 18297 | 7779 | int numtrigs = s_version < 36 ? 3 : 6; | |
| 18298 |
2/2✓ Branch 0 taken 45816 times.
✓ Branch 1 taken 7779 times.
|
53595 | for ( int32_t q = 0; q < numtrigs; q++ ) |
| 18299 |
1/2✓ Branch 0 taken 45816 times.
✗ Branch 1 not taken.
|
45816 | if(!p_igetl(&temp_trigflags[q],f)) |
| 18300 | ✗ | return qe_invalid; | |
| 18301 | 7779 | temp_trigger.trigger_flags.clear(); | |
| 18302 |
2/2✓ Branch 0 taken 1466112 times.
✓ Branch 1 taken 7779 times.
|
1473891 | for(size_t q = 0; q < 32*numtrigs; ++q) |
| 18303 | { | ||
| 18304 | 1466112 | auto ind = q/32; | |
| 18305 | 1466112 | auto bit = 1<<(q%32); | |
| 18306 |
2/2✓ Branch 0 taken 1452438 times.
✓ Branch 1 taken 13674 times.
|
1466112 | if(temp_trigflags[ind] & bit) |
| 18307 | 13674 | temp_trigger.trigger_flags.set(q, true); | |
| 18308 | 1466112 | } | |
| 18309 | 7779 | } | |
| 18310 |
1/2✓ Branch 0 taken 8980 times.
✗ Branch 1 not taken.
|
8980 | else if(!p_getbitstr(&temp_trigger.trigger_flags,f)) |
| 18311 | ✗ | return qe_invalid; | |
| 18312 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(!p_igetl(&temp_trigger.triggerlevel,f)) |
| 18313 | ✗ | return qe_invalid; | |
| 18314 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(!p_getc(&temp_trigger.triggerbtn,f)) |
| 18315 | ✗ | return qe_invalid; | |
| 18316 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(!p_getc(&temp_trigger.triggeritem,f)) |
| 18317 | ✗ | return qe_invalid; | |
| 18318 |
2/2✓ Branch 0 taken 9226 times.
✓ Branch 1 taken 7533 times.
|
16759 | if(s_version >= 53) |
| 18319 | { | ||
| 18320 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_igetw(&temp_trigger.trigtimer,f)) |
| 18321 | ✗ | return qe_invalid; | |
| 18322 | 9226 | } | |
| 18323 | else | ||
| 18324 | { | ||
| 18325 |
1/2✓ Branch 0 taken 7533 times.
✗ Branch 1 not taken.
|
7533 | if(!p_getc(&tempbyte, f)) |
| 18326 | ✗ | return qe_invalid; | |
| 18327 | 7533 | temp_trigger.trigtimer = tempbyte; | |
| 18328 | } | ||
| 18329 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(!p_getc(&temp_trigger.trigsfx,f)) |
| 18330 | ✗ | return qe_invalid; | |
| 18331 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(!p_igetl(&temp_trigger.trigchange,f)) |
| 18332 | ✗ | return qe_invalid; | |
| 18333 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(!p_igetw(&temp_trigger.trigprox,f)) |
| 18334 | ✗ | return qe_invalid; | |
| 18335 |
2/2✓ Branch 0 taken 9226 times.
✓ Branch 1 taken 7533 times.
|
16759 | if(s_version >= 53) |
| 18336 | { | ||
| 18337 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_igetw(&temp_trigger.trigctr,f)) |
| 18338 | ✗ | return qe_invalid; | |
| 18339 | 9226 | } | |
| 18340 | else | ||
| 18341 | { | ||
| 18342 |
1/2✓ Branch 0 taken 7533 times.
✗ Branch 1 not taken.
|
7533 | if(!p_getc(&tempbyte,f)) |
| 18343 | ✗ | return qe_invalid; | |
| 18344 | 7533 | temp_trigger.trigctr = tempbyte; | |
| 18345 | } | ||
| 18346 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(!p_igetl(&temp_trigger.trigctramnt,f)) |
| 18347 | ✗ | return qe_invalid; | |
| 18348 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(!p_getc(&temp_trigger.triglbeam,f)) |
| 18349 | ✗ | return qe_invalid; | |
| 18350 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(!p_getc(&temp_trigger.trigcschange,f)) |
| 18351 | ✗ | return qe_invalid; | |
| 18352 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(!p_igetw(&temp_trigger.spawnitem,f)) |
| 18353 | ✗ | return qe_invalid; | |
| 18354 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(!p_igetw(&temp_trigger.spawnenemy,f)) |
| 18355 | ✗ | return qe_invalid; | |
| 18356 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(!p_getc(&temp_trigger.exstate,f)) |
| 18357 | ✗ | return qe_invalid; | |
| 18358 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(!p_igetl(&temp_trigger.spawnip,f)) |
| 18359 | ✗ | return qe_invalid; | |
| 18360 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(!p_getc(&temp_trigger.trigcopycat,f)) |
| 18361 | ✗ | return qe_invalid; | |
| 18362 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(!p_getc(&temp_trigger.trigcooldown,f)) |
| 18363 | ✗ | return qe_invalid; | |
| 18364 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16759 times.
|
16759 | if(s_version >= 35) |
| 18365 | { | ||
| 18366 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(!p_igetw(&temp_trigger.prompt_cid,f)) |
| 18367 | ✗ | return qe_invalid; | |
| 18368 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(!p_getc(&temp_trigger.prompt_cs,f)) |
| 18369 | ✗ | return qe_invalid; | |
| 18370 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(!p_igetw(&temp_trigger.prompt_x,f)) |
| 18371 | ✗ | return qe_invalid; | |
| 18372 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(!p_igetw(&temp_trigger.prompt_y,f)) |
| 18373 | ✗ | return qe_invalid; | |
| 18374 | 16759 | } | |
| 18375 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 16473 times.
|
16759 | if(s_version >= 36) |
| 18376 | { | ||
| 18377 |
1/2✓ Branch 0 taken 16473 times.
✗ Branch 1 not taken.
|
16473 | if(!p_getc(&temp_trigger.trig_lstate,f)) |
| 18378 | ✗ | return qe_invalid; | |
| 18379 |
1/2✓ Branch 0 taken 16473 times.
✗ Branch 1 not taken.
|
16473 | if(!p_getc(&temp_trigger.trig_gstate,f)) |
| 18380 | ✗ | return qe_invalid; | |
| 18381 |
1/2✓ Branch 0 taken 16473 times.
✗ Branch 1 not taken.
|
16473 | if(!p_igetl(&temp_trigger.trig_statetime,f)) |
| 18382 | ✗ | return qe_invalid; | |
| 18383 | 16473 | } | |
| 18384 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 16473 times.
|
16759 | if(s_version >= 37) |
| 18385 | { | ||
| 18386 |
1/2✓ Branch 0 taken 16473 times.
✗ Branch 1 not taken.
|
16473 | if(!p_igetw(&temp_trigger.trig_genscr,f)) |
| 18387 | ✗ | return qe_invalid; | |
| 18388 | 16473 | } | |
| 18389 |
2/2✓ Branch 0 taken 434 times.
✓ Branch 1 taken 16325 times.
|
16759 | if(s_version >= 38) |
| 18390 | { | ||
| 18391 |
1/2✓ Branch 0 taken 16325 times.
✗ Branch 1 not taken.
|
16325 | if(!p_getc(&temp_trigger.trig_group,f)) |
| 18392 | ✗ | return qe_invalid; | |
| 18393 |
1/2✓ Branch 0 taken 16325 times.
✗ Branch 1 not taken.
|
16325 | if(!p_igetw(&temp_trigger.trig_group_val,f)) |
| 18394 | ✗ | return qe_invalid; | |
| 18395 | 16325 | } | |
| 18396 |
2/2✓ Branch 0 taken 470 times.
✓ Branch 1 taken 16289 times.
|
16759 | if(s_version >= 45) |
| 18397 | { | ||
| 18398 |
1/2✓ Branch 0 taken 16289 times.
✗ Branch 1 not taken.
|
16289 | if(!p_getc(&temp_trigger.exdoor_dir,f)) |
| 18399 | ✗ | return qe_invalid; | |
| 18400 |
1/2✓ Branch 0 taken 16289 times.
✗ Branch 1 not taken.
|
16289 | if(!p_getc(&temp_trigger.exdoor_ind,f)) |
| 18401 | ✗ | return qe_invalid; | |
| 18402 | 16289 | } | |
| 18403 |
2/2✓ Branch 0 taken 7533 times.
✓ Branch 1 taken 9226 times.
|
16759 | if(s_version >= 46) |
| 18404 | { | ||
| 18405 |
2/2✓ Branch 0 taken 5920 times.
✓ Branch 1 taken 3306 times.
|
9226 | if (s_version >= 59) |
| 18406 | { | ||
| 18407 |
1/2✓ Branch 0 taken 5920 times.
✗ Branch 1 not taken.
|
5920 | if(!p_igetw(&temp_trigger.trig_levelitems,f)) |
| 18408 | ✗ | return qe_invalid; | |
| 18409 | 5920 | } | |
| 18410 | else | ||
| 18411 | { | ||
| 18412 |
1/2✓ Branch 0 taken 3306 times.
✗ Branch 1 not taken.
|
3306 | if(!p_getc(&tempbyte,f)) |
| 18413 | ✗ | return qe_invalid; | |
| 18414 | 3306 | temp_trigger.trig_levelitems = word(tempbyte); | |
| 18415 | } | ||
| 18416 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_igetw(&temp_trigger.trigdmlevel,f)) |
| 18417 | ✗ | return qe_invalid; | |
| 18418 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(s_version >= 48) |
| 18419 | { | ||
| 18420 |
2/2✓ Branch 0 taken 27678 times.
✓ Branch 1 taken 9226 times.
|
36904 | for(int q = 0; q < 3; ++q) |
| 18421 |
1/2✓ Branch 0 taken 27678 times.
✗ Branch 1 not taken.
|
27678 | if(!p_igetw(&temp_trigger.trigtint[q],f)) |
| 18422 | ✗ | return qe_invalid; | |
| 18423 | 9226 | } | |
| 18424 | else | ||
| 18425 | { | ||
| 18426 | ✗ | for(int q = 0; q < 3; ++q) | |
| 18427 | ✗ | if(!p_getc(&temp_trigger.trigtint[q],f)) | |
| 18428 | ✗ | return qe_invalid; | |
| 18429 | ✗ | for(int q = 0; q < 3; ++q) | |
| 18430 | { | ||
| 18431 | ✗ | int v = temp_trigger.trigtint[q]; | |
| 18432 | ✗ | int va = abs(v); | |
| 18433 | ✗ | temp_trigger.trigtint[q] = _rgb_scale_6[va] * sign(v); | |
| 18434 | ✗ | } | |
| 18435 | } | ||
| 18436 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_igetw(&temp_trigger.triglvlpalette,f)) |
| 18437 | ✗ | return qe_invalid; | |
| 18438 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_igetw(&temp_trigger.trigbosspalette,f)) |
| 18439 | ✗ | return qe_invalid; | |
| 18440 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_igetw(&temp_trigger.trigquaketime,f)) |
| 18441 | ✗ | return qe_invalid; | |
| 18442 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_igetw(&temp_trigger.trigwavytime,f)) |
| 18443 | ✗ | return qe_invalid; | |
| 18444 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_igetw(&temp_trigger.trig_swjinxtime,f)) |
| 18445 | ✗ | return qe_invalid; | |
| 18446 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_igetw(&temp_trigger.trig_itmjinxtime,f)) |
| 18447 | ✗ | return qe_invalid; | |
| 18448 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_igetw(&temp_trigger.trig_stuntime,f)) |
| 18449 | ✗ | return qe_invalid; | |
| 18450 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_igetw(&temp_trigger.trig_bunnytime,f)) |
| 18451 | ✗ | return qe_invalid; | |
| 18452 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9226 times.
|
9226 | if(!p_getc(&temp_trigger.trig_pushtime,f)) |
| 18453 | ✗ | return qe_invalid; | |
| 18454 | 9226 | } | |
| 18455 |
2/2✓ Branch 0 taken 7533 times.
✓ Branch 1 taken 9226 times.
|
16759 | if(s_version >= 47) |
| 18456 | { | ||
| 18457 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if (!p_igetw(&temp_trigger.trig_shieldjinxtime, f)) |
| 18458 | ✗ | return qe_invalid; | |
| 18459 | 9226 | } | |
| 18460 |
2/2✓ Branch 0 taken 9226 times.
✓ Branch 1 taken 7533 times.
|
16759 | if(s_version >= 53) |
| 18461 | { | ||
| 18462 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_igetl(&temp_trigger.req_level_state, f)) |
| 18463 | ✗ | return qe_invalid; | |
| 18464 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_igetl(&temp_trigger.unreq_level_state, f)) |
| 18465 | ✗ | return qe_invalid; | |
| 18466 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_getbitstr(&temp_trigger.req_global_state, f)) |
| 18467 | ✗ | return qe_invalid; | |
| 18468 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_getbitstr(&temp_trigger.unreq_global_state, f)) |
| 18469 | ✗ | return qe_invalid; | |
| 18470 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_igetw(&temp_trigger.fail_prompt_cid,f)) |
| 18471 | ✗ | return qe_invalid; | |
| 18472 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_getc(&temp_trigger.fail_prompt_cs,f)) |
| 18473 | ✗ | return qe_invalid; | |
| 18474 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_igetl(&temp_trigger.trig_msgstr, f)) |
| 18475 | ✗ | return qe_invalid; | |
| 18476 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_igetl(&temp_trigger.fail_msgstr, f)) |
| 18477 | ✗ | return qe_invalid; | |
| 18478 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_igetzf(&temp_trigger.player_bounce, f)) |
| 18479 | ✗ | return qe_invalid; | |
| 18480 |
1/2✓ Branch 0 taken 9226 times.
✗ Branch 1 not taken.
|
9226 | if(!p_igetzf(&temp_trigger.req_player_z, f)) |
| 18481 | ✗ | return qe_invalid; | |
| 18482 | 9226 | } | |
| 18483 | else | ||
| 18484 | { | ||
| 18485 | 7533 | temp_trigger.fail_prompt_cid = temp_trigger.prompt_cid; | |
| 18486 | 7533 | temp_trigger.fail_prompt_cs = temp_trigger.prompt_cs; | |
| 18487 | } | ||
| 18488 |
2/2✓ Branch 0 taken 7779 times.
✓ Branch 1 taken 8980 times.
|
16759 | if(s_version >= 54) |
| 18489 | { | ||
| 18490 |
1/2✓ Branch 0 taken 8980 times.
✗ Branch 1 not taken.
|
8980 | if(!p_getc(&temp_trigger.req_player_dir,f)) |
| 18491 | ✗ | return qe_invalid; | |
| 18492 |
1/2✓ Branch 0 taken 8980 times.
✗ Branch 1 not taken.
|
8980 | if(!p_igetzf(&temp_trigger.dest_player_x, f)) |
| 18493 | ✗ | return qe_invalid; | |
| 18494 |
1/2✓ Branch 0 taken 8980 times.
✗ Branch 1 not taken.
|
8980 | if(!p_igetzf(&temp_trigger.dest_player_y, f)) |
| 18495 | ✗ | return qe_invalid; | |
| 18496 |
1/2✓ Branch 0 taken 8980 times.
✗ Branch 1 not taken.
|
8980 | if(!p_igetzf(&temp_trigger.dest_player_z, f)) |
| 18497 | ✗ | return qe_invalid; | |
| 18498 |
1/2✓ Branch 0 taken 8980 times.
✗ Branch 1 not taken.
|
8980 | if(!p_igetzf(&temp_trigger.req_player_jump, f)) |
| 18499 | ✗ | return qe_invalid; | |
| 18500 |
1/2✓ Branch 0 taken 8980 times.
✗ Branch 1 not taken.
|
8980 | if(!p_igetzf(&temp_trigger.req_player_x, f)) |
| 18501 | ✗ | return qe_invalid; | |
| 18502 |
1/2✓ Branch 0 taken 8980 times.
✗ Branch 1 not taken.
|
8980 | if(!p_igetzf(&temp_trigger.req_player_y, f)) |
| 18503 | ✗ | return qe_invalid; | |
| 18504 | 8980 | } | |
| 18505 |
2/2✓ Branch 0 taken 7779 times.
✓ Branch 1 taken 8980 times.
|
16759 | if(s_version >= 56) |
| 18506 | { | ||
| 18507 |
1/2✓ Branch 0 taken 8980 times.
✗ Branch 1 not taken.
|
8980 | if(!p_getc(&temp_trigger.dest_player_dir, f)) |
| 18508 | ✗ | return qe_invalid; | |
| 18509 |
1/2✓ Branch 0 taken 8980 times.
✗ Branch 1 not taken.
|
8980 | if(!p_igetl(&temp_trigger.force_ice_combo, f)) |
| 18510 | ✗ | return qe_invalid; | |
| 18511 |
1/2✓ Branch 0 taken 8980 times.
✗ Branch 1 not taken.
|
8980 | if(!p_igetzf(&temp_trigger.force_ice_vx, f)) |
| 18512 | ✗ | return qe_invalid; | |
| 18513 |
1/2✓ Branch 0 taken 8980 times.
✗ Branch 1 not taken.
|
8980 | if(!p_igetzf(&temp_trigger.force_ice_vy, f)) |
| 18514 | ✗ | return qe_invalid; | |
| 18515 | 8980 | } | |
| 18516 |
2/2✓ Branch 0 taken 10839 times.
✓ Branch 1 taken 5920 times.
|
16759 | if(s_version >= 58) |
| 18517 | { | ||
| 18518 |
1/2✓ Branch 0 taken 5920 times.
✗ Branch 1 not taken.
|
5920 | if(!p_igetzf(&temp_trigger.trig_gravity, f)) |
| 18519 | ✗ | return qe_invalid; | |
| 18520 |
1/2✓ Branch 0 taken 5920 times.
✗ Branch 1 not taken.
|
5920 | if(!p_igetzf(&temp_trigger.trig_terminal_v, f)) |
| 18521 | ✗ | return qe_invalid; | |
| 18522 | 5920 | } | |
| 18523 |
2/2✓ Branch 0 taken 11351 times.
✓ Branch 1 taken 5408 times.
|
16759 | if (s_version >= 61) |
| 18524 | { | ||
| 18525 |
1/2✓ Branch 0 taken 5408 times.
✗ Branch 1 not taken.
|
5408 | if(!p_getbitstr(&temp_trigger.req_screen_state, f)) |
| 18526 | ✗ | return qe_invalid; | |
| 18527 |
1/2✓ Branch 0 taken 5408 times.
✗ Branch 1 not taken.
|
5408 | if(!p_getbitstr(&temp_trigger.unreq_screen_state, f)) |
| 18528 | ✗ | return qe_invalid; | |
| 18529 |
1/2✓ Branch 0 taken 5408 times.
✗ Branch 1 not taken.
|
5408 | if(!p_getbitstr(&temp_trigger.req_screen_ex_state, f)) |
| 18530 | ✗ | return qe_invalid; | |
| 18531 |
1/2✓ Branch 0 taken 5408 times.
✗ Branch 1 not taken.
|
5408 | if(!p_getbitstr(&temp_trigger.unreq_screen_ex_state, f)) |
| 18532 | ✗ | return qe_invalid; | |
| 18533 |
1/2✓ Branch 0 taken 5408 times.
✗ Branch 1 not taken.
|
5408 | if(!p_getc(&temp_trigger.trigstatemap, f)) |
| 18534 | ✗ | return qe_invalid; | |
| 18535 |
1/2✓ Branch 0 taken 5408 times.
✗ Branch 1 not taken.
|
5408 | if(!p_getc(&temp_trigger.trigstatescreen, f)) |
| 18536 | ✗ | return qe_invalid; | |
| 18537 | 5408 | } | |
| 18538 |
2/2✓ Branch 0 taken 11752 times.
✓ Branch 1 taken 5007 times.
|
16759 | if (s_version >= 62) |
| 18539 | { | ||
| 18540 |
1/2✓ Branch 0 taken 5007 times.
✗ Branch 1 not taken.
|
5007 | if(!p_igetl(&temp_trigger.play_music, f)) |
| 18541 | ✗ | return qe_invalid; | |
| 18542 |
1/2✓ Branch 0 taken 5007 times.
✗ Branch 1 not taken.
|
5007 | if(!p_getc(&temp_trigger.set_music_refresh, f)) |
| 18543 | ✗ | return qe_invalid; | |
| 18544 | 5007 | } | |
| 18545 | 16759 | return 0; | |
| 18546 | 16759 | } | |
| 18547 | |||
| 18548 | 1690804 | int32_t readcombo_loop(PACKFILE* f, word s_version, newcombo& temp_combo) | |
| 18549 | { | ||
| 18550 | byte tempbyte; | ||
| 18551 | word tempword; | ||
| 18552 | word combo_has_flags; | ||
| 18553 |
2/2✓ Branch 0 taken 516098 times.
✓ Branch 1 taken 1174706 times.
|
1690804 | if(s_version < 55) |
| 18554 | { | ||
| 18555 |
1/2✓ Branch 0 taken 516098 times.
✗ Branch 1 not taken.
|
516098 | if(!p_getc(&tempbyte,f)) |
| 18556 | ✗ | return qe_invalid; | |
| 18557 | 516098 | combo_has_flags = tempbyte; | |
| 18558 | 516098 | } | |
| 18559 | else | ||
| 18560 | { | ||
| 18561 |
1/2✓ Branch 0 taken 1174706 times.
✗ Branch 1 not taken.
|
1174706 | if(!p_igetw(&combo_has_flags,f)) |
| 18562 | ✗ | return qe_invalid; | |
| 18563 | } | ||
| 18564 | |||
| 18565 | 1690804 | temp_combo.clear(); | |
| 18566 |
2/2✓ Branch 0 taken 291243 times.
✓ Branch 1 taken 1399561 times.
|
1690804 | if(combo_has_flags) |
| 18567 | { | ||
| 18568 |
2/2✓ Branch 0 taken 608483 times.
✓ Branch 1 taken 791078 times.
|
1399561 | if(combo_has_flags&CHAS_BASIC) |
| 18569 | { | ||
| 18570 |
1/2✓ Branch 0 taken 791078 times.
✗ Branch 1 not taken.
|
791078 | if(!p_igetl(&temp_combo.tile,f)) |
| 18571 | ✗ | return qe_invalid; | |
| 18572 | 791078 | temp_combo.o_tile = temp_combo.tile; | |
| 18573 | |||
| 18574 |
1/2✓ Branch 0 taken 791078 times.
✗ Branch 1 not taken.
|
791078 | if(!p_getc(&temp_combo.flip,f)) |
| 18575 | ✗ | return qe_invalid; | |
| 18576 | |||
| 18577 |
1/2✓ Branch 0 taken 791078 times.
✗ Branch 1 not taken.
|
791078 | if(!p_getc(&temp_combo.walk,f)) |
| 18578 | ✗ | return qe_invalid; | |
| 18579 | |||
| 18580 |
1/2✓ Branch 0 taken 791078 times.
✗ Branch 1 not taken.
|
791078 | if(!p_getc(&temp_combo.type,f)) |
| 18581 | ✗ | return qe_invalid; | |
| 18582 | |||
| 18583 |
1/2✓ Branch 0 taken 791078 times.
✗ Branch 1 not taken.
|
791078 | if(!p_getc(&temp_combo.flag,f)) |
| 18584 | ✗ | return qe_invalid; | |
| 18585 | |||
| 18586 |
1/2✓ Branch 0 taken 791078 times.
✗ Branch 1 not taken.
|
791078 | if(!p_getc(&temp_combo.csets,f)) |
| 18587 | ✗ | return qe_invalid; | |
| 18588 | 791078 | } | |
| 18589 |
2/2✓ Branch 0 taken 1396013 times.
✓ Branch 1 taken 3548 times.
|
1399561 | if(combo_has_flags&CHAS_SCRIPT) |
| 18590 | { | ||
| 18591 |
2/2✓ Branch 0 taken 3518 times.
✓ Branch 1 taken 30 times.
|
3548 | if (s_version>=41) |
| 18592 | { | ||
| 18593 | 3518 | p_getcstr(&temp_combo.label, f); | |
| 18594 | 3518 | } | |
| 18595 | else | ||
| 18596 | { | ||
| 18597 | char label[12]; | ||
| 18598 | 30 | label[11] = '\0'; | |
| 18599 |
2/2✓ Branch 0 taken 330 times.
✓ Branch 1 taken 30 times.
|
360 | for ( int32_t q = 0; q < 11; q++ ) |
| 18600 |
1/2✓ Branch 0 taken 330 times.
✗ Branch 1 not taken.
|
330 | if(!p_getc(&label[q],f)) |
| 18601 | ✗ | return qe_invalid; | |
| 18602 | 30 | temp_combo.label = label; | |
| 18603 | } | ||
| 18604 | |||
| 18605 |
1/2✓ Branch 0 taken 3548 times.
✗ Branch 1 not taken.
|
3548 | if(!p_igetw(&temp_combo.script,f)) return qe_invalid; |
| 18606 | 3548 | auto initd_count = s_version >= 43 ? 8 : 2; | |
| 18607 |
2/2✓ Branch 0 taken 28204 times.
✓ Branch 1 taken 3548 times.
|
31752 | for ( int32_t q = 0; q < initd_count; q++ ) |
| 18608 |
1/2✓ Branch 0 taken 28204 times.
✗ Branch 1 not taken.
|
28204 | if(!p_igetl(&temp_combo.initd[q],f)) |
| 18609 | ✗ | return qe_invalid; | |
| 18610 | 3548 | } | |
| 18611 |
2/2✓ Branch 0 taken 1214076 times.
✓ Branch 1 taken 185485 times.
|
1399561 | if(combo_has_flags&CHAS_ANIM) |
| 18612 | { | ||
| 18613 |
1/2✓ Branch 0 taken 185485 times.
✗ Branch 1 not taken.
|
185485 | if(!p_getc(&temp_combo.frames,f)) |
| 18614 | ✗ | return qe_invalid; | |
| 18615 | |||
| 18616 |
1/2✓ Branch 0 taken 185485 times.
✗ Branch 1 not taken.
|
185485 | if(!p_getc(&temp_combo.speed,f)) |
| 18617 | ✗ | return qe_invalid; | |
| 18618 | |||
| 18619 |
1/2✓ Branch 0 taken 185485 times.
✗ Branch 1 not taken.
|
185485 | if(!p_igetw(&temp_combo.nextcombo,f)) |
| 18620 | ✗ | return qe_invalid; | |
| 18621 | |||
| 18622 |
1/2✓ Branch 0 taken 185485 times.
✗ Branch 1 not taken.
|
185485 | if(!p_getc(&temp_combo.nextcset,f)) |
| 18623 | ✗ | return qe_invalid; | |
| 18624 | |||
| 18625 |
1/2✓ Branch 0 taken 185485 times.
✗ Branch 1 not taken.
|
185485 | if(!p_getc(&temp_combo.skipanim,f)) |
| 18626 | ✗ | return qe_invalid; | |
| 18627 | |||
| 18628 |
1/2✓ Branch 0 taken 185485 times.
✗ Branch 1 not taken.
|
185485 | if(!p_getc(&temp_combo.skipanimy,f)) |
| 18629 | ✗ | return qe_invalid; | |
| 18630 | |||
| 18631 |
1/2✓ Branch 0 taken 185485 times.
✗ Branch 1 not taken.
|
185485 | if(!p_getc(&temp_combo.animflags,f)) |
| 18632 | ✗ | return qe_invalid; | |
| 18633 | 185485 | } | |
| 18634 |
2/2✓ Branch 0 taken 1333747 times.
✓ Branch 1 taken 65814 times.
|
1399561 | if(combo_has_flags&CHAS_ATTRIB) |
| 18635 | { | ||
| 18636 |
2/2✓ Branch 0 taken 43911 times.
✓ Branch 1 taken 21903 times.
|
65814 | if (s_version < 63) |
| 18637 | { | ||
| 18638 |
2/2✓ Branch 0 taken 175644 times.
✓ Branch 1 taken 43911 times.
|
219555 | for ( int32_t q = 0; q < 4; q++ ) |
| 18639 |
1/2✓ Branch 0 taken 175644 times.
✗ Branch 1 not taken.
|
175644 | if(!p_igetzf(&temp_combo.c_attributes[q],f)) |
| 18640 | ✗ | return qe_invalid; | |
| 18641 |
2/2✓ Branch 0 taken 351288 times.
✓ Branch 1 taken 43911 times.
|
395199 | for ( int32_t q = 0; q < 8; q++ ) |
| 18642 | { | ||
| 18643 |
1/2✓ Branch 0 taken 351288 times.
✗ Branch 1 not taken.
|
351288 | if(!p_getc(&tempbyte,f)) |
| 18644 | ✗ | return qe_invalid; | |
| 18645 | 351288 | temp_combo.c_attributes[8 + q] = tempbyte; | |
| 18646 | 351288 | } | |
| 18647 |
2/2✓ Branch 0 taken 351288 times.
✓ Branch 1 taken 43911 times.
|
395199 | for ( int32_t q = 0; q < 8; q++ ) |
| 18648 | { | ||
| 18649 |
1/2✓ Branch 0 taken 351288 times.
✗ Branch 1 not taken.
|
351288 | if(!p_igetw(&tempword,f)) |
| 18650 | ✗ | return qe_invalid; | |
| 18651 | 351288 | temp_combo.c_attributes[16 + q] = int16_t(tempword); | |
| 18652 | 351288 | } | |
| 18653 | 43911 | } | |
| 18654 | else | ||
| 18655 | { | ||
| 18656 | word num_attributes; | ||
| 18657 |
1/2✓ Branch 0 taken 21903 times.
✗ Branch 1 not taken.
|
21903 | if (!p_igetw(&num_attributes, f)) |
| 18658 | ✗ | return qe_invalid; | |
| 18659 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21903 times.
|
21903 | if (num_attributes > NUM_COMBO_ATTRIBUTES) |
| 18660 | ✗ | return qe_invalid; | |
| 18661 |
2/2✓ Branch 0 taken 525672 times.
✓ Branch 1 taken 21903 times.
|
547575 | for (size_t q = 0; q < num_attributes; ++q) |
| 18662 | { | ||
| 18663 |
1/2✓ Branch 0 taken 525672 times.
✗ Branch 1 not taken.
|
525672 | if (!p_igetzf(&temp_combo.c_attributes[q],f)) |
| 18664 | ✗ | return qe_invalid; | |
| 18665 | 525672 | } | |
| 18666 | } | ||
| 18667 | 65814 | } | |
| 18668 |
2/2✓ Branch 0 taken 1383177 times.
✓ Branch 1 taken 16384 times.
|
1399561 | if(combo_has_flags&CHAS_FLAG) |
| 18669 | { | ||
| 18670 |
1/2✓ Branch 0 taken 16384 times.
✗ Branch 1 not taken.
|
16384 | if(!p_igetl(&temp_combo.usrflags,f)) |
| 18671 | ✗ | return qe_invalid; | |
| 18672 |
1/2✓ Branch 0 taken 16384 times.
✗ Branch 1 not taken.
|
16384 | if(!p_igetw(&temp_combo.genflags,f)) |
| 18673 | ✗ | return qe_invalid; | |
| 18674 | 16384 | } | |
| 18675 |
2/2✓ Branch 0 taken 1382920 times.
✓ Branch 1 taken 16641 times.
|
1399561 | if(combo_has_flags&CHAS_TRIG) |
| 18676 | { | ||
| 18677 | 16641 | byte count = 1; | |
| 18678 |
2/2✓ Branch 0 taken 7533 times.
✓ Branch 1 taken 9108 times.
|
16641 | if(s_version >= 52) |
| 18679 |
1/2✓ Branch 0 taken 9108 times.
✗ Branch 1 not taken.
|
9108 | if(!p_getc(&count, f)) |
| 18680 | ✗ | return qe_invalid; | |
| 18681 | |||
| 18682 |
2/2✓ Branch 0 taken 16759 times.
✓ Branch 1 taken 16641 times.
|
33400 | for(byte q = 0; q < count; ++q) |
| 18683 | { | ||
| 18684 | 16759 | combo_trigger& temp_trigger = temp_combo.triggers.emplace_back(); | |
| 18685 | 16759 | auto ret = readcombo_triggers_loop(f, s_version, temp_trigger); | |
| 18686 |
1/2✓ Branch 0 taken 16759 times.
✗ Branch 1 not taken.
|
16759 | if(ret) |
| 18687 | ✗ | return ret; | |
| 18688 | 16759 | } | |
| 18689 | |||
| 18690 |
2/2✓ Branch 0 taken 7533 times.
✓ Branch 1 taken 9108 times.
|
16641 | if(s_version < 52) |
| 18691 | { | ||
| 18692 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7533 times.
|
7533 | if(!temp_combo.triggers.empty()) |
| 18693 | 7533 | temp_combo.only_gentrig = (temp_combo.triggers[0].trigger_flags.get(TRIGFLAG_ONLYGENTRIG)) ? 1 : 0; | |
| 18694 | 7533 | } | |
| 18695 |
1/2✓ Branch 0 taken 9108 times.
✗ Branch 1 not taken.
|
9108 | else if(!p_getc(&temp_combo.only_gentrig,f)) |
| 18696 | ✗ | return qe_invalid; | |
| 18697 | 16641 | } | |
| 18698 |
2/2✓ Branch 0 taken 224729 times.
✓ Branch 1 taken 1174832 times.
|
1399561 | if(combo_has_flags&CHAS_LIFT) |
| 18699 | { | ||
| 18700 |
1/2✓ Branch 0 taken 1174832 times.
✗ Branch 1 not taken.
|
1174832 | if(!p_igetw(&temp_combo.liftcmb,f)) |
| 18701 | ✗ | return qe_invalid; | |
| 18702 |
1/2✓ Branch 0 taken 1174832 times.
✗ Branch 1 not taken.
|
1174832 | if(!p_getc(&temp_combo.liftcs,f)) |
| 18703 | ✗ | return qe_invalid; | |
| 18704 |
1/2✓ Branch 0 taken 1174832 times.
✗ Branch 1 not taken.
|
1174832 | if(!p_igetw(&temp_combo.liftundercmb,f)) |
| 18705 | ✗ | return qe_invalid; | |
| 18706 |
1/2✓ Branch 0 taken 1174832 times.
✗ Branch 1 not taken.
|
1174832 | if(!p_getc(&temp_combo.liftundercs,f)) |
| 18707 | ✗ | return qe_invalid; | |
| 18708 |
1/2✓ Branch 0 taken 1174832 times.
✗ Branch 1 not taken.
|
1174832 | if(!p_getc(&temp_combo.liftdmg,f)) |
| 18709 | ✗ | return qe_invalid; | |
| 18710 |
1/2✓ Branch 0 taken 1174832 times.
✗ Branch 1 not taken.
|
1174832 | if(!p_getc(&temp_combo.liftlvl,f)) |
| 18711 | ✗ | return qe_invalid; | |
| 18712 |
1/2✓ Branch 0 taken 1174832 times.
✗ Branch 1 not taken.
|
1174832 | if(!p_getc(&temp_combo.liftitm,f)) |
| 18713 | ✗ | return qe_invalid; | |
| 18714 |
1/2✓ Branch 0 taken 1174832 times.
✗ Branch 1 not taken.
|
1174832 | if(!p_getc(&temp_combo.liftflags,f)) |
| 18715 | ✗ | return qe_invalid; | |
| 18716 |
1/2✓ Branch 0 taken 1174832 times.
✗ Branch 1 not taken.
|
1174832 | if(!p_getc(&temp_combo.liftgfx,f)) |
| 18717 | ✗ | return qe_invalid; | |
| 18718 |
1/2✓ Branch 0 taken 1174832 times.
✗ Branch 1 not taken.
|
1174832 | if(!p_getc(&temp_combo.liftsprite,f)) |
| 18719 | ✗ | return qe_invalid; | |
| 18720 |
1/2✓ Branch 0 taken 1174832 times.
✗ Branch 1 not taken.
|
1174832 | if(!p_getc(&temp_combo.liftsfx,f)) |
| 18721 | ✗ | return qe_invalid; | |
| 18722 |
1/2✓ Branch 0 taken 1174832 times.
✗ Branch 1 not taken.
|
1174832 | if(!p_igetw(&temp_combo.liftbreaksprite,f)) |
| 18723 | ✗ | return qe_invalid; | |
| 18724 |
1/2✓ Branch 0 taken 1174832 times.
✗ Branch 1 not taken.
|
1174832 | if(!p_getc(&temp_combo.liftbreaksfx,f)) |
| 18725 | ✗ | return qe_invalid; | |
| 18726 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1174832 times.
|
1174832 | if(s_version >= 34) |
| 18727 | { | ||
| 18728 |
1/2✓ Branch 0 taken 1174832 times.
✗ Branch 1 not taken.
|
1174832 | if(!p_getc(&temp_combo.lifthei,f)) |
| 18729 | ✗ | return qe_invalid; | |
| 18730 |
1/2✓ Branch 0 taken 1174832 times.
✗ Branch 1 not taken.
|
1174832 | if(!p_getc(&temp_combo.lifttime,f)) |
| 18731 | ✗ | return qe_invalid; | |
| 18732 | 1174832 | } | |
| 18733 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 1174818 times.
|
1174832 | if(s_version >= 39) |
| 18734 | { | ||
| 18735 |
1/2✓ Branch 0 taken 1174818 times.
✗ Branch 1 not taken.
|
1174818 | if(!p_getc(&temp_combo.lift_parent_item,f)) |
| 18736 | ✗ | return qe_invalid; | |
| 18737 | 1174818 | } | |
| 18738 | 1174832 | auto& weap_data = temp_combo.lift_weap_data; | |
| 18739 |
4/4✓ Branch 0 taken 1174730 times.
✓ Branch 1 taken 102 times.
✓ Branch 2 taken 1174706 times.
✓ Branch 3 taken 24 times.
|
1174832 | if(s_version >= 51 && s_version < 55) |
| 18740 | { | ||
| 18741 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&weap_data.light_rads[WPNSPR_BASE],f)) |
| 18742 | ✗ | return qe_invalid; | |
| 18743 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&weap_data.glow_shape,f)) |
| 18744 | ✗ | return qe_invalid; | |
| 18745 | 24 | } | |
| 18746 | |||
| 18747 |
2/2✓ Branch 0 taken 1174706 times.
✓ Branch 1 taken 126 times.
|
1174832 | if(s_version >= 55) |
| 18748 | { | ||
| 18749 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1174706 times.
|
1174706 | if(auto ret = read_weap_data(weap_data, f)) |
| 18750 | ✗ | return ret; | |
| 18751 | 1174706 | } | |
| 18752 | else | ||
| 18753 | { | ||
| 18754 | 126 | auto const& pitm = itemsbuf[temp_combo.lift_parent_item]; | |
| 18755 | 126 | auto weap_glow = weap_data.light_rads[WPNSPR_BASE]; | |
| 18756 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 120 times.
|
126 | switch(pitm.type) |
| 18757 | { | ||
| 18758 | case itype_bomb: | ||
| 18759 | case itype_sbomb: | ||
| 18760 | 6 | weap_data = pitm.weap_data; | |
| 18761 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if(!(weap_data.wflags & WFLAG_UPDATE_IGNITE_SPRITE)) |
| 18762 | { | ||
| 18763 | 6 | weap_data.flags |= wdata_glow_rad; | |
| 18764 | 6 | weap_data.light_rads[WPNSPR_BASE] = weap_glow; | |
| 18765 | 6 | } | |
| 18766 | 6 | break; | |
| 18767 | default: | ||
| 18768 | 120 | weap_data.wflags |= WFLAG_BREAK_WHEN_LANDING; | |
| 18769 | 120 | weap_data.flags |= wdata_glow_rad; | |
| 18770 | 120 | } | |
| 18771 | 126 | weap_data.moveflags |= move_obeys_grav|move_can_pitfall; | |
| 18772 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 66 times.
|
126 | if(temp_combo.liftflags & LF_BREAKONSOLID) |
| 18773 | 60 | weap_data.wflags |= WFLAG_BREAK_ON_SOLID; | |
| 18774 | } | ||
| 18775 | 1174832 | } | |
| 18776 | |||
| 18777 |
2/2✓ Branch 0 taken 1362941 times.
✓ Branch 1 taken 36620 times.
|
1399561 | if(combo_has_flags&CHAS_GENERAL) |
| 18778 | { | ||
| 18779 |
1/2✓ Branch 0 taken 36620 times.
✗ Branch 1 not taken.
|
36620 | if(!p_getc(&temp_combo.speed_mult,f)) |
| 18780 | ✗ | return qe_invalid; | |
| 18781 |
1/2✓ Branch 0 taken 36620 times.
✗ Branch 1 not taken.
|
36620 | if(!p_getc(&temp_combo.speed_div,f)) |
| 18782 | ✗ | return qe_invalid; | |
| 18783 |
1/2✓ Branch 0 taken 36620 times.
✗ Branch 1 not taken.
|
36620 | if(!p_igetzf(&temp_combo.speed_add,f)) |
| 18784 | ✗ | return qe_invalid; | |
| 18785 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36620 times.
|
36620 | if(s_version >= 42) |
| 18786 | { | ||
| 18787 |
1/2✓ Branch 0 taken 36620 times.
✗ Branch 1 not taken.
|
36620 | if(!p_getc(&temp_combo.sfx_appear,f)) |
| 18788 | ✗ | return qe_invalid; | |
| 18789 |
1/2✓ Branch 0 taken 36620 times.
✗ Branch 1 not taken.
|
36620 | if(!p_getc(&temp_combo.sfx_disappear,f)) |
| 18790 | ✗ | return qe_invalid; | |
| 18791 |
1/2✓ Branch 0 taken 36620 times.
✗ Branch 1 not taken.
|
36620 | if(!p_getc(&temp_combo.sfx_loop,f)) |
| 18792 | ✗ | return qe_invalid; | |
| 18793 |
1/2✓ Branch 0 taken 36620 times.
✗ Branch 1 not taken.
|
36620 | if(!p_getc(&temp_combo.sfx_walking,f)) |
| 18794 | ✗ | return qe_invalid; | |
| 18795 |
1/2✓ Branch 0 taken 36620 times.
✗ Branch 1 not taken.
|
36620 | if(!p_getc(&temp_combo.sfx_standing,f)) |
| 18796 | ✗ | return qe_invalid; | |
| 18797 |
1/2✓ Branch 0 taken 36620 times.
✗ Branch 1 not taken.
|
36620 | if(!p_getc(&temp_combo.spr_appear,f)) |
| 18798 | ✗ | return qe_invalid; | |
| 18799 |
1/2✓ Branch 0 taken 36620 times.
✗ Branch 1 not taken.
|
36620 | if(!p_getc(&temp_combo.spr_disappear,f)) |
| 18800 | ✗ | return qe_invalid; | |
| 18801 |
1/2✓ Branch 0 taken 36620 times.
✗ Branch 1 not taken.
|
36620 | if(!p_getc(&temp_combo.spr_walking,f)) |
| 18802 | ✗ | return qe_invalid; | |
| 18803 |
1/2✓ Branch 0 taken 36620 times.
✗ Branch 1 not taken.
|
36620 | if(!p_getc(&temp_combo.spr_standing,f)) |
| 18804 | ✗ | return qe_invalid; | |
| 18805 | 36620 | } | |
| 18806 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36620 times.
|
36620 | if(s_version >= 44) |
| 18807 | { | ||
| 18808 |
1/2✓ Branch 0 taken 36620 times.
✗ Branch 1 not taken.
|
36620 | if(!p_getc(&temp_combo.sfx_tap,f)) |
| 18809 | ✗ | return qe_invalid; | |
| 18810 | 36620 | } | |
| 18811 |
2/2✓ Branch 0 taken 384 times.
✓ Branch 1 taken 36236 times.
|
36620 | if(s_version >= 49) |
| 18812 | { | ||
| 18813 |
1/2✓ Branch 0 taken 36236 times.
✗ Branch 1 not taken.
|
36236 | if(!p_getc(&temp_combo.sfx_landing,f)) |
| 18814 | ✗ | return qe_invalid; | |
| 18815 | 36236 | } | |
| 18816 |
2/2✓ Branch 0 taken 384 times.
✓ Branch 1 taken 36236 times.
|
36620 | if(s_version >= 50) |
| 18817 | { | ||
| 18818 |
1/2✓ Branch 0 taken 36236 times.
✗ Branch 1 not taken.
|
36236 | if(!p_getc(&temp_combo.spr_falling,f)) |
| 18819 | ✗ | return qe_invalid; | |
| 18820 |
1/2✓ Branch 0 taken 36236 times.
✗ Branch 1 not taken.
|
36236 | if(!p_getc(&temp_combo.spr_drowning,f)) |
| 18821 | ✗ | return qe_invalid; | |
| 18822 |
1/2✓ Branch 0 taken 36236 times.
✗ Branch 1 not taken.
|
36236 | if(!p_getc(&temp_combo.spr_lava_drowning,f)) |
| 18823 | ✗ | return qe_invalid; | |
| 18824 |
1/2✓ Branch 0 taken 36236 times.
✗ Branch 1 not taken.
|
36236 | if(!p_getc(&temp_combo.sfx_falling,f)) |
| 18825 | ✗ | return qe_invalid; | |
| 18826 |
1/2✓ Branch 0 taken 36236 times.
✗ Branch 1 not taken.
|
36236 | if(!p_getc(&temp_combo.sfx_drowning,f)) |
| 18827 | ✗ | return qe_invalid; | |
| 18828 |
1/2✓ Branch 0 taken 36236 times.
✗ Branch 1 not taken.
|
36236 | if(!p_getc(&temp_combo.sfx_lava_drowning,f)) |
| 18829 | ✗ | return qe_invalid; | |
| 18830 | 36236 | } | |
| 18831 |
2/2✓ Branch 0 taken 1878 times.
✓ Branch 1 taken 34742 times.
|
36620 | if(s_version >= 56) |
| 18832 | { | ||
| 18833 |
1/2✓ Branch 0 taken 34742 times.
✗ Branch 1 not taken.
|
34742 | if(!p_igetzf(&temp_combo.z_height,f)) |
| 18834 | ✗ | return qe_invalid; | |
| 18835 |
1/2✓ Branch 0 taken 34742 times.
✗ Branch 1 not taken.
|
34742 | if(!p_igetzf(&temp_combo.z_step_height,f)) |
| 18836 | ✗ | return qe_invalid; | |
| 18837 | 34742 | } | |
| 18838 |
2/2✓ Branch 0 taken 3208 times.
✓ Branch 1 taken 33412 times.
|
36620 | if(s_version >= 60) |
| 18839 | { | ||
| 18840 |
1/2✓ Branch 0 taken 33412 times.
✗ Branch 1 not taken.
|
33412 | if(!p_getc(&temp_combo.dive_under_level,f)) |
| 18841 | ✗ | return qe_invalid; | |
| 18842 | 33412 | } | |
| 18843 | 36620 | } | |
| 18844 |
2/2✓ Branch 0 taken 1399558 times.
✓ Branch 1 taken 3 times.
|
1399561 | if(combo_has_flags&CHAS_MISC_WEAP_DATA) |
| 18845 | { | ||
| 18846 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if(auto ret = read_weap_data(temp_combo.misc_weap_data, f)) |
| 18847 | ✗ | return ret; | |
| 18848 | 3 | } | |
| 18849 | 1399561 | } | |
| 18850 | 1690804 | update_combo(temp_combo, s_version); | |
| 18851 | 1690804 | return 0; | |
| 18852 | 1690804 | } | |
| 18853 | |||
| 18854 | 497 | int32_t readcombos(PACKFILE *f, zquestheader *Header, word version, word build, word start_combo, word max_combos) | |
| 18855 | { | ||
| 18856 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 24 times.
|
497 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_combos); |
| 18857 | |||
| 18858 | 497 | word section_version=0; | |
| 18859 | 497 | word combos_used=0; | |
| 18860 | int32_t dummy; | ||
| 18861 | byte padding; | ||
| 18862 | 497 | newcombo temp_combo; | |
| 18863 | |||
| 18864 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 496 times.
|
497 | if (!should_skip) |
| 18865 | { | ||
| 18866 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | reset_all_combo_animations(); |
| 18867 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | init_combo_classes(); |
| 18868 | |||
| 18869 |
2/2✓ Branch 0 taken 32378880 times.
✓ Branch 1 taken 496 times.
|
32379376 | for(int32_t q = start_combo; q < start_combo+max_combos; ++q) |
| 18870 |
1/2✓ Branch 0 taken 32378880 times.
✗ Branch 1 not taken.
|
32378880 | combobuf[q].clear(); |
| 18871 | 496 | } | |
| 18872 | |||
| 18873 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 24 times.
|
497 | if(version > 0x192) //Version info |
| 18874 | { | ||
| 18875 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 473 times.
✗ Branch 3 not taken.
|
473 | if(!p_igetw(§ion_version,f)) |
| 18876 | { | ||
| 18877 | ✗ | return qe_invalid; | |
| 18878 | } | ||
| 18879 | 473 | FFCore.quest_format[vCombos] = section_version; | |
| 18880 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 473 times.
✗ Branch 3 not taken.
|
473 | if(!read_deprecated_section_cversion(f)) |
| 18881 | { | ||
| 18882 | ✗ | return qe_invalid; | |
| 18883 | } | ||
| 18884 | |||
| 18885 | //section size | ||
| 18886 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 473 times.
✗ Branch 3 not taken.
|
473 | if(!p_igetl(&dummy,f)) |
| 18887 | { | ||
| 18888 | ✗ | return qe_invalid; | |
| 18889 | } | ||
| 18890 | 473 | } | |
| 18891 | |||
| 18892 |
2/2✓ Branch 0 taken 210 times.
✓ Branch 1 taken 287 times.
|
497 | if(section_version > 32) //Cleanup time! |
| 18893 | { | ||
| 18894 |
2/4✓ Branch 0 taken 210 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 210 times.
✗ Branch 3 not taken.
|
210 | if(!p_igetw(&combos_used,f)) |
| 18895 | { | ||
| 18896 | ✗ | return qe_invalid; | |
| 18897 | } | ||
| 18898 |
2/2✓ Branch 0 taken 1690804 times.
✓ Branch 1 taken 210 times.
|
1691014 | for(int32_t i=0; i<combos_used; i++) |
| 18899 | { | ||
| 18900 |
1/2✓ Branch 0 taken 1690804 times.
✗ Branch 1 not taken.
|
1690804 | auto ret = readcombo_loop(f,section_version,temp_combo); |
| 18901 |
1/2✓ Branch 0 taken 1690804 times.
✗ Branch 1 not taken.
|
1690804 | if(ret) return ret; |
| 18902 |
1/2✓ Branch 0 taken 1690804 times.
✗ Branch 1 not taken.
|
1690804 | if(i>=start_combo) |
| 18903 | { | ||
| 18904 |
1/2✓ Branch 0 taken 1690804 times.
✗ Branch 1 not taken.
|
1690804 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 18905 | { | ||
| 18906 | ✗ | temp_combo.script = 0; | |
| 18907 | ✗ | for(int q = 0; q < 8; ++q) | |
| 18908 | ✗ | temp_combo.initd[q] = 0; | |
| 18909 | ✗ | } | |
| 18910 |
1/2✓ Branch 0 taken 1690804 times.
✗ Branch 1 not taken.
|
1690804 | combobuf[i] = temp_combo; |
| 18911 | 1690804 | } | |
| 18912 | 1690804 | } | |
| 18913 | 210 | } | |
| 18914 | else //Call the old function for all old versions | ||
| 18915 | { | ||
| 18916 |
1/2✓ Branch 0 taken 287 times.
✗ Branch 1 not taken.
|
287 | auto ret = readcombos_old(section_version,f,Header,version,build,start_combo,max_combos); |
| 18917 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 287 times.
|
287 | if(ret) return ret; //error, end read |
| 18918 | } | ||
| 18919 | |||
| 18920 |
2/2✓ Branch 0 taken 496 times.
✓ Branch 1 taken 1 times.
|
497 | if (should_skip) |
| 18921 | 1 | return 0; | |
| 18922 | |||
| 18923 |
2/2✓ Branch 0 taken 295 times.
✓ Branch 1 taken 201 times.
|
496 | if(!get_qr(qr_ALLOW_EDITING_COMBO_0)) |
| 18924 | { | ||
| 18925 | 201 | combobuf[0].walk = 0xF0; | |
| 18926 | 201 | combobuf[0].type = 0; | |
| 18927 | 201 | combobuf[0].flag = 0; | |
| 18928 | 201 | } | |
| 18929 | |||
| 18930 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | setup_combo_animations(); |
| 18931 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | setup_combo_animations2(); |
| 18932 | 496 | return 0; | |
| 18933 | 497 | } | |
| 18934 | |||
| 18935 | 415 | int32_t readcomboaliases(PACKFILE *f, zquestheader *Header, word version, word build) | |
| 18936 | { | ||
| 18937 | //these are here to bypass compiler warnings about unused arguments | ||
| 18938 | 415 | Header=Header; | |
| 18939 | 415 | version=version; | |
| 18940 | 415 | build=build; | |
| 18941 | |||
| 18942 | int32_t dummy; | ||
| 18943 | 415 | word sversion=0, c_sversion; | |
| 18944 | |||
| 18945 | //section version info | ||
| 18946 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if(!p_igetw(&sversion,f)) |
| 18947 | { | ||
| 18948 | ✗ | return qe_invalid; | |
| 18949 | } | ||
| 18950 | |||
| 18951 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if (sversion > V_COMBOALIASES) |
| 18952 | ✗ | return qe_version; | |
| 18953 | |||
| 18954 | 415 | FFCore.quest_format[vComboAliases] = sversion; | |
| 18955 | |||
| 18956 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(!p_igetw(&c_sversion,f)) |
| 18957 | { | ||
| 18958 | ✗ | return qe_invalid; | |
| 18959 | } | ||
| 18960 | |||
| 18961 | //section size | ||
| 18962 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(!p_igetl(&dummy,f)) |
| 18963 | { | ||
| 18964 | ✗ | return qe_invalid; | |
| 18965 | } | ||
| 18966 | |||
| 18967 | 415 | int32_t max_num_combo_aliases = MAXCOMBOALIASES; | |
| 18968 | |||
| 18969 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 200 times.
|
415 | if(sversion < 3) // max saved combo alias' upped from 256 to 2048. |
| 18970 | { | ||
| 18971 | 200 | max_num_combo_aliases = MAX250COMBOALIASES; | |
| 18972 | 200 | } | |
| 18973 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(sversion < 2) // max saved combo alias' upped from 256 to 2048. |
| 18974 | { | ||
| 18975 | ✗ | max_num_combo_aliases = OLDMAXCOMBOALIASES; | |
| 18976 | ✗ | } | |
| 18977 | |||
| 18978 |
2/2✓ Branch 0 taken 2170880 times.
✓ Branch 1 taken 415 times.
|
2171295 | for(int32_t j=0; j<max_num_combo_aliases; j++) |
| 18979 | { | ||
| 18980 | byte width,height,mask,tempcset; | ||
| 18981 | int32_t count; | ||
| 18982 | word tempword; | ||
| 18983 | byte tempbyte; | ||
| 18984 | |||
| 18985 |
1/2✓ Branch 0 taken 2170880 times.
✗ Branch 1 not taken.
|
2170880 | if(!p_igetw(&tempword,f)) |
| 18986 | { | ||
| 18987 | ✗ | return qe_invalid; | |
| 18988 | } | ||
| 18989 | |||
| 18990 | 2170880 | combo_aliases[j].combo = tempword; | |
| 18991 | |||
| 18992 |
1/2✓ Branch 0 taken 2170880 times.
✗ Branch 1 not taken.
|
2170880 | if(!p_getc(&tempbyte,f)) |
| 18993 | { | ||
| 18994 | ✗ | return qe_invalid; | |
| 18995 | } | ||
| 18996 | |||
| 18997 | 2170880 | combo_aliases[j].cset = tempbyte; | |
| 18998 | |||
| 18999 |
1/2✓ Branch 0 taken 2170880 times.
✗ Branch 1 not taken.
|
2170880 | if(!p_getc(&width,f)) |
| 19000 | { | ||
| 19001 | ✗ | return qe_invalid; | |
| 19002 | } | ||
| 19003 | |||
| 19004 |
1/2✓ Branch 0 taken 2170880 times.
✗ Branch 1 not taken.
|
2170880 | if(!p_getc(&height,f)) |
| 19005 | { | ||
| 19006 | ✗ | return qe_invalid; | |
| 19007 | } | ||
| 19008 | |||
| 19009 |
1/2✓ Branch 0 taken 2170880 times.
✗ Branch 1 not taken.
|
2170880 | if(!p_getc(&mask,f)) |
| 19010 | { | ||
| 19011 | ✗ | return qe_invalid; | |
| 19012 | } | ||
| 19013 | |||
| 19014 | 2170880 | count=(width+1)*(height+1)*(comboa_lmasktotal(mask)+1); | |
| 19015 | |||
| 19016 | 2170880 | combo_aliases[j].width = width; | |
| 19017 | 2170880 | combo_aliases[j].height = height; | |
| 19018 | 2170880 | combo_aliases[j].layermask = mask; | |
| 19019 | 2170880 | combo_aliases[j].combos.clear(); | |
| 19020 | 2170880 | combo_aliases[j].csets.clear(); | |
| 19021 | |||
| 19022 |
2/2✓ Branch 0 taken 2229109 times.
✓ Branch 1 taken 2170880 times.
|
4399989 | for(int32_t k=0; k<count; k++) |
| 19023 | { | ||
| 19024 |
1/2✓ Branch 0 taken 2229109 times.
✗ Branch 1 not taken.
|
2229109 | if(!p_igetw(&tempword,f)) |
| 19025 | { | ||
| 19026 | ✗ | return qe_invalid; | |
| 19027 | } | ||
| 19028 | |||
| 19029 | 2229109 | combo_aliases[j].combos[k] = tempword; | |
| 19030 | 2229109 | } | |
| 19031 | |||
| 19032 |
2/2✓ Branch 0 taken 2229109 times.
✓ Branch 1 taken 2170880 times.
|
4399989 | for(int32_t k=0; k<count; k++) |
| 19033 | { | ||
| 19034 |
1/2✓ Branch 0 taken 2229109 times.
✗ Branch 1 not taken.
|
2229109 | if(!p_getc(&tempcset,f)) |
| 19035 | { | ||
| 19036 | ✗ | return qe_invalid; | |
| 19037 | } | ||
| 19038 | |||
| 19039 | 2229109 | combo_aliases[j].csets[k] = tempcset; | |
| 19040 | 2229109 | } | |
| 19041 | 2170880 | } | |
| 19042 | |||
| 19043 | //Combo pools! | ||
| 19044 | 415 | word num_combo_pools = 0; | |
| 19045 |
2/2✓ Branch 0 taken 205 times.
✓ Branch 1 taken 210 times.
|
415 | if(sversion >= 4) |
| 19046 | { | ||
| 19047 |
1/2✓ Branch 0 taken 210 times.
✗ Branch 1 not taken.
|
210 | if(!p_igetw(&num_combo_pools,f)) |
| 19048 | { | ||
| 19049 | ✗ | return qe_invalid; | |
| 19050 | } | ||
| 19051 | 210 | } | |
| 19052 | |||
| 19053 |
2/2✓ Branch 0 taken 3399680 times.
✓ Branch 1 taken 415 times.
|
3400095 | for(combo_pool& pool : combo_pools) |
| 19054 | { | ||
| 19055 | 3399680 | pool.clear(); | |
| 19056 | } | ||
| 19057 | |||
| 19058 | 415 | combo_pool temp_cpool; | |
| 19059 |
2/2✓ Branch 0 taken 708 times.
✓ Branch 1 taken 415 times.
|
1123 | for(word cp = 0; cp < num_combo_pools; ++cp) |
| 19060 | { | ||
| 19061 | 708 | int32_t num_combos_in_pool = 0; | |
| 19062 |
2/4✓ Branch 0 taken 708 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 708 times.
✗ Branch 3 not taken.
|
708 | if(!p_igetl(&num_combos_in_pool,f)) |
| 19063 | { | ||
| 19064 | ✗ | return qe_invalid; | |
| 19065 | } | ||
| 19066 |
2/2✓ Branch 0 taken 602 times.
✓ Branch 1 taken 106 times.
|
708 | if(num_combos_in_pool < 1) continue; //nothing to read |
| 19067 | |||
| 19068 |
1/2✓ Branch 0 taken 602 times.
✗ Branch 1 not taken.
|
602 | temp_cpool.clear(); |
| 19069 | |||
| 19070 | int32_t cp_cid; int8_t cp_cs; word cp_quant; | ||
| 19071 |
2/2✓ Branch 0 taken 602 times.
✓ Branch 1 taken 2753 times.
|
3355 | for(auto q = 0; q < num_combos_in_pool; ++q) |
| 19072 | { | ||
| 19073 |
2/4✓ Branch 0 taken 2753 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2753 times.
✗ Branch 3 not taken.
|
2753 | if(!p_igetl(&cp_cid,f)) |
| 19074 | { | ||
| 19075 | ✗ | return qe_invalid; | |
| 19076 | } | ||
| 19077 |
2/4✓ Branch 0 taken 2753 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2753 times.
✗ Branch 3 not taken.
|
2753 | if(!p_getc(&cp_cs,f)) |
| 19078 | { | ||
| 19079 | ✗ | return qe_invalid; | |
| 19080 | } | ||
| 19081 |
2/4✓ Branch 0 taken 2753 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2753 times.
✗ Branch 3 not taken.
|
2753 | if(!p_igetw(&cp_quant,f)) |
| 19082 | { | ||
| 19083 | ✗ | return qe_invalid; | |
| 19084 | } | ||
| 19085 |
1/2✓ Branch 0 taken 2753 times.
✗ Branch 1 not taken.
|
2753 | temp_cpool.add(cp_cid, cp_cs, cp_quant); |
| 19086 | 2753 | } | |
| 19087 | |||
| 19088 |
1/2✓ Branch 0 taken 602 times.
✗ Branch 1 not taken.
|
602 | combo_pools[cp] = temp_cpool; |
| 19089 | 602 | } | |
| 19090 | |||
| 19091 | //Autocombos! | ||
| 19092 | 415 | word num_combo_autos = 0; | |
| 19093 |
2/2✓ Branch 0 taken 198 times.
✓ Branch 1 taken 217 times.
|
415 | if (sversion >= 5) |
| 19094 | { | ||
| 19095 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if (!p_igetw(&num_combo_autos, f)) |
| 19096 | { | ||
| 19097 | ✗ | return qe_invalid; | |
| 19098 | } | ||
| 19099 | 198 | } | |
| 19100 | |||
| 19101 |
2/2✓ Branch 0 taken 415 times.
✓ Branch 1 taken 3399680 times.
|
3400095 | for (combo_auto& cauto : combo_autos) |
| 19102 | { | ||
| 19103 |
1/2✓ Branch 0 taken 3399680 times.
✗ Branch 1 not taken.
|
3399680 | cauto.clear(true); |
| 19104 | } | ||
| 19105 | |||
| 19106 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | combo_auto temp_cauto; |
| 19107 |
2/2✓ Branch 0 taken 154 times.
✓ Branch 1 taken 415 times.
|
569 | for (word ca = 0; ca < num_combo_autos; ++ca) |
| 19108 | { | ||
| 19109 | byte type; | ||
| 19110 | int32_t display_cid, erase_cid; | ||
| 19111 | byte flags, arg; | ||
| 19112 |
2/4✓ Branch 0 taken 154 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 154 times.
✗ Branch 3 not taken.
|
154 | if (!p_getc(&type, f)) |
| 19113 | { | ||
| 19114 | ✗ | return qe_invalid; | |
| 19115 | } | ||
| 19116 |
2/4✓ Branch 0 taken 154 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 154 times.
✗ Branch 3 not taken.
|
154 | if (!p_igetl(&display_cid, f)) |
| 19117 | { | ||
| 19118 | ✗ | return qe_invalid; | |
| 19119 | } | ||
| 19120 |
2/4✓ Branch 0 taken 154 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 154 times.
✗ Branch 3 not taken.
|
154 | if (!p_igetl(&erase_cid, f)) |
| 19121 | { | ||
| 19122 | ✗ | return qe_invalid; | |
| 19123 | } | ||
| 19124 |
2/4✓ Branch 0 taken 154 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 154 times.
✗ Branch 3 not taken.
|
154 | if (!p_getc(&flags, f)) |
| 19125 | { | ||
| 19126 | ✗ | return qe_invalid; | |
| 19127 | } | ||
| 19128 |
2/4✓ Branch 0 taken 154 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 154 times.
✗ Branch 3 not taken.
|
154 | if (!p_getc(&arg, f)) |
| 19129 | { | ||
| 19130 | ✗ | return qe_invalid; | |
| 19131 | } | ||
| 19132 | 154 | int32_t num_combos_in_cauto = 0; | |
| 19133 |
2/4✓ Branch 0 taken 154 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 154 times.
✗ Branch 3 not taken.
|
154 | if (!p_igetl(&num_combos_in_cauto, f)) |
| 19134 | { | ||
| 19135 | ✗ | return qe_invalid; | |
| 19136 | } | ||
| 19137 |
2/2✓ Branch 0 taken 133 times.
✓ Branch 1 taken 21 times.
|
154 | if (num_combos_in_cauto < 1) continue; //nothing to read |
| 19138 | |||
| 19139 |
1/2✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
|
133 | temp_cauto.clear(); |
| 19140 | |||
| 19141 |
1/2✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
|
133 | temp_cauto.setType(type); |
| 19142 |
1/2✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
|
133 | temp_cauto.setDisplay(display_cid); |
| 19143 |
1/2✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
|
133 | temp_cauto.setEraseCombo(erase_cid); |
| 19144 |
1/2✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
|
133 | temp_cauto.setFlags(flags); |
| 19145 |
1/2✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
|
133 | temp_cauto.setArg(arg); |
| 19146 | |||
| 19147 | int32_t ca_cid; byte ca_ctype; int16_t ca_offset; int16_t ca_engrave_offset; | ||
| 19148 |
2/2✓ Branch 0 taken 133 times.
✓ Branch 1 taken 3389 times.
|
3522 | for (auto q = 0; q < num_combos_in_cauto; ++q) |
| 19149 | { | ||
| 19150 |
2/4✓ Branch 0 taken 3389 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3389 times.
✗ Branch 3 not taken.
|
3389 | if (!p_getc(&ca_ctype, f)) |
| 19151 | { | ||
| 19152 | ✗ | return qe_invalid; | |
| 19153 | } | ||
| 19154 |
2/4✓ Branch 0 taken 3389 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3389 times.
✗ Branch 3 not taken.
|
3389 | if (!p_igetl(&ca_cid, f)) |
| 19155 | { | ||
| 19156 | ✗ | return qe_invalid; | |
| 19157 | } | ||
| 19158 |
1/2✓ Branch 0 taken 3389 times.
✗ Branch 1 not taken.
|
3389 | temp_cauto.addEntry(ca_cid, ca_ctype, q, -1); |
| 19159 | 3389 | } | |
| 19160 | |||
| 19161 |
1/2✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
|
133 | combo_autos[ca] = temp_cauto; |
| 19162 | 133 | } | |
| 19163 | |||
| 19164 | 415 | return 0; | |
| 19165 | 415 | } | |
| 19166 | |||
| 19167 | 830 | int32_t readcolordata(PACKFILE *f, miscQdata *Misc, word version, word build, word start_cset, word max_csets) | |
| 19168 | { | ||
| 19169 |
2/2✓ Branch 0 taken 806 times.
✓ Branch 1 taken 24 times.
|
830 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_colors); |
| 19170 | |||
| 19171 | //these are here to bypass compiler warnings about unused arguments | ||
| 19172 | //THE *48 REFERS TO EACH CSET BEING 16 COLORS with 3 VALUES OF RGB (3*16 is 48) | ||
| 19173 | //Capitalized cause it'll save you a headache. -Deedee | ||
| 19174 | 830 | start_cset=start_cset; | |
| 19175 | 830 | max_csets=max_csets; | |
| 19176 | 830 | word s_version=0; | |
| 19177 | |||
| 19178 | 830 | miscQdata temp_misc; | |
| 19179 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | temp_misc = *Misc; |
| 19180 | |||
| 19181 | byte temp_colordata[48]; | ||
| 19182 | char temp_palname[PALNAMESIZE+1]; | ||
| 19183 | |||
| 19184 | int32_t dummy; | ||
| 19185 | word palcycles; | ||
| 19186 | |||
| 19187 |
2/2✓ Branch 0 taken 806 times.
✓ Branch 1 taken 24 times.
|
830 | if(version > 0x192) |
| 19188 | { | ||
| 19189 | //section version info | ||
| 19190 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_igetw(&s_version,f)) |
| 19191 | { | ||
| 19192 | ✗ | return qe_invalid; | |
| 19193 | } | ||
| 19194 | |||
| 19195 |
1/2✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
|
806 | if (s_version > V_CSETS) |
| 19196 | ✗ | return qe_version; | |
| 19197 | |||
| 19198 | 806 | FFCore.quest_format[vCSets] = s_version; | |
| 19199 | |||
| 19200 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_igetw(&dummy,f)) |
| 19201 | { | ||
| 19202 | ✗ | return qe_invalid; | |
| 19203 | } | ||
| 19204 | |||
| 19205 | //section size | ||
| 19206 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_igetl(&dummy,f)) |
| 19207 | { | ||
| 19208 | ✗ | return qe_invalid; | |
| 19209 | } | ||
| 19210 | 806 | } | |
| 19211 |
2/2✓ Branch 0 taken 615 times.
✓ Branch 1 taken 215 times.
|
830 | if (s_version < 5) |
| 19212 | { | ||
| 19213 |
4/4✓ Branch 0 taken 18 times.
✓ Branch 1 taken 597 times.
✓ Branch 2 taken 591 times.
✓ Branch 3 taken 6 times.
|
615 | bool RealOldVerion = ((version < 0x192)||((version == 0x192)&&(build<73))); |
| 19214 | |||
| 19215 | //finally... section data | ||
| 19216 | 615 | int32_t q = 0; | |
| 19217 | 615 | int32_t p = -15; | |
| 19218 |
2/2✓ Branch 0 taken 147600 times.
✓ Branch 1 taken 615 times.
|
148215 | for(int32_t i=0; i<oldpdTOTAL; ++i) |
| 19219 | { | ||
| 19220 | 147600 | memset(temp_colordata, 0, 48); | |
| 19221 | |||
| 19222 |
2/4✓ Branch 0 taken 147600 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 147600 times.
✗ Branch 3 not taken.
|
147600 | if(!pfread(temp_colordata,48,f)) |
| 19223 | { | ||
| 19224 | ✗ | return qe_invalid; | |
| 19225 | } | ||
| 19226 | |||
| 19227 |
2/2✓ Branch 0 taken 240 times.
✓ Branch 1 taken 147360 times.
|
147600 | if (should_skip) |
| 19228 | 240 | continue; | |
| 19229 | |||
| 19230 | 147360 | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 19231 | |||
| 19232 | 147360 | ++q; | |
| 19233 |
8/8✓ Branch 0 taken 137536 times.
✓ Branch 1 taken 9824 times.
✓ Branch 2 taken 10438 times.
✓ Branch 3 taken 127098 times.
✓ Branch 4 taken 1228 times.
✓ Branch 5 taken 9210 times.
✓ Branch 6 taken 36 times.
✓ Branch 7 taken 1192 times.
|
147360 | if (p > 0 && (p%13)==12 && (i < oldpoSPRITE || !RealOldVerion)) //It's > 0 instead of >= 0 because it should append |
| 19234 | { | ||
| 19235 |
1/2✓ Branch 0 taken 10402 times.
✗ Branch 1 not taken.
|
10402 | if (s_version < 5) //Bumping up the size of level palettes |
| 19236 | { | ||
| 19237 | 10402 | memcpy(&colordata[(q)*48], &colordata[1*48], 48); | |
| 19238 | 10402 | memcpy(&colordata[(q+1)*48], &colordata[5*48], 48); | |
| 19239 | 10402 | memcpy(&colordata[(q+2)*48], &colordata[7*48], 48); | |
| 19240 | 10402 | memcpy(&colordata[(q+3)*48], &colordata[8*48], 48); | |
| 19241 | 10402 | q+=4; | |
| 19242 | 10402 | } | |
| 19243 | else | ||
| 19244 | { | ||
| 19245 | ✗ | for(int m = 0; m < 4; ++m) | |
| 19246 | { | ||
| 19247 | ✗ | memset(temp_colordata, 0, 48); | |
| 19248 | ✗ | if(!pfread(temp_colordata,48,f)) | |
| 19249 | { | ||
| 19250 | ✗ | return qe_invalid; | |
| 19251 | } | ||
| 19252 | ✗ | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 19253 | ✗ | ++q; | |
| 19254 | ✗ | } | |
| 19255 | } | ||
| 19256 | 10402 | } | |
| 19257 | 147360 | ++p; | |
| 19258 | 147360 | } | |
| 19259 | |||
| 19260 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 597 times.
|
615 | if(RealOldVerion) |
| 19261 | { | ||
| 19262 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | if (!should_skip) |
| 19263 | { | ||
| 19264 | 18 | memcpy(colordata+(poSPRITE255*48), colordata+((q-30)*48), 30*16*3); | |
| 19265 | 18 | memset(colordata+((q-30)*48), 0, ((poSPRITE255-(q-30))*48)); | |
| 19266 | 18 | memcpy(colordata+((poSPRITE255+11)*48), colordata+((poSPRITE255+10)*48), 48); | |
| 19267 | 18 | memcpy(colordata+((poSPRITE255+10)*48), colordata+((poSPRITE255+9)*48), 48); | |
| 19268 | 18 | memcpy(colordata+((poSPRITE255+9)*48), colordata+((poSPRITE255+8)*48), 48); | |
| 19269 | 18 | memset(colordata+((poSPRITE255+8)*48), 0, 48); | |
| 19270 | 18 | } | |
| 19271 | 18 | } | |
| 19272 | else | ||
| 19273 | { | ||
| 19274 | 597 | memset(temp_colordata, 0, 48); | |
| 19275 | |||
| 19276 |
2/2✓ Branch 0 taken 1870401 times.
✓ Branch 1 taken 597 times.
|
1870998 | for(int32_t i=0; i<newpdTOTAL-oldpdTOTAL; ++i) |
| 19277 | { | ||
| 19278 |
2/4✓ Branch 0 taken 1870401 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1870401 times.
✗ Branch 3 not taken.
|
1870401 | if(!pfread(temp_colordata,48,f)) |
| 19279 | { | ||
| 19280 | ✗ | return qe_invalid; | |
| 19281 | } | ||
| 19282 | |||
| 19283 |
2/2✓ Branch 0 taken 3133 times.
✓ Branch 1 taken 1867268 times.
|
1870401 | if (should_skip) |
| 19284 | 3133 | continue; | |
| 19285 | |||
| 19286 | 1867268 | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 19287 | |||
| 19288 | 1867268 | ++q; | |
| 19289 |
7/8✓ Branch 0 taken 1867268 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 143636 times.
✓ Branch 3 taken 1723632 times.
✓ Branch 4 taken 1192 times.
✓ Branch 5 taken 142444 times.
✓ Branch 6 taken 1066 times.
✓ Branch 7 taken 126 times.
|
1867268 | if (p > 0 && (p%13)==12 && (i < (newpoSPRITE-oldpdTOTAL) || (s_version >= 4))) //It's > 0 instead of >= 0 because it should append |
| 19290 | { | ||
| 19291 |
1/2✓ Branch 0 taken 143510 times.
✗ Branch 1 not taken.
|
143510 | if (s_version < 5) //Bumping up the size of level palettes |
| 19292 | { | ||
| 19293 | 143510 | memcpy(&colordata[(q)*48], &colordata[1*48], 48); | |
| 19294 | 143510 | memcpy(&colordata[(q+1)*48], &colordata[5*48], 48); | |
| 19295 | 143510 | memcpy(&colordata[(q+2)*48], &colordata[7*48], 48); | |
| 19296 | 143510 | memcpy(&colordata[(q+3)*48], &colordata[8*48], 48); | |
| 19297 | 143510 | q+=4; | |
| 19298 | 143510 | } | |
| 19299 | else | ||
| 19300 | { | ||
| 19301 | ✗ | for(int m = 0; m < 4; ++m) | |
| 19302 | { | ||
| 19303 | ✗ | memset(temp_colordata, 0, 48); | |
| 19304 | ✗ | if(!pfread(temp_colordata,48,f)) | |
| 19305 | { | ||
| 19306 | ✗ | return qe_invalid; | |
| 19307 | } | ||
| 19308 | ✗ | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 19309 | ✗ | ++q; | |
| 19310 | ✗ | } | |
| 19311 | } | ||
| 19312 | 143510 | } | |
| 19313 | 1867268 | ++p; | |
| 19314 | 1867268 | } | |
| 19315 | |||
| 19316 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 533 times.
|
597 | if(s_version < 4) |
| 19317 | { | ||
| 19318 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 63 times.
|
64 | if (!should_skip) |
| 19319 | { | ||
| 19320 | 63 | memcpy(colordata+(poSPRITE255*48), colordata+((q-30)*48), 30*16*3); | |
| 19321 | 63 | memset(colordata+((q-30)*48), 0, ((poSPRITE255-(q-30))*48)); | |
| 19322 | 63 | } | |
| 19323 | 64 | } | |
| 19324 | else | ||
| 19325 | { | ||
| 19326 |
2/2✓ Branch 0 taken 1773824 times.
✓ Branch 1 taken 533 times.
|
1774357 | for(int32_t i=0; i<newerpdTOTAL-newpdTOTAL; ++i) |
| 19327 | { | ||
| 19328 |
2/4✓ Branch 0 taken 1773824 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1773824 times.
✗ Branch 3 not taken.
|
1773824 | if(!pfread(temp_colordata,48,f)) |
| 19329 | { | ||
| 19330 | ✗ | return qe_invalid; | |
| 19331 | } | ||
| 19332 | |||
| 19333 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1773824 times.
|
1773824 | if (should_skip) |
| 19334 | ✗ | continue; | |
| 19335 | |||
| 19336 | 1773824 | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 19337 | 1773824 | ++q; | |
| 19338 |
5/6✓ Branch 0 taken 1773824 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 136448 times.
✓ Branch 3 taken 1637376 times.
✓ Branch 4 taken 1066 times.
✓ Branch 5 taken 135382 times.
|
1773824 | if (p > 0 && (p%13)==12 && i < newerpoSPRITE-newpdTOTAL) //It's > 0 instead of >= 0 because it should append |
| 19339 | { | ||
| 19340 |
1/2✓ Branch 0 taken 135382 times.
✗ Branch 1 not taken.
|
135382 | if (s_version < 5) //Bumping up the size of level palettes |
| 19341 | { | ||
| 19342 | 135382 | memcpy(&colordata[(q)*48], &colordata[1*48], 48); | |
| 19343 | 135382 | memcpy(&colordata[(q+1)*48], &colordata[5*48], 48); | |
| 19344 | 135382 | memcpy(&colordata[(q+2)*48], &colordata[7*48], 48); | |
| 19345 | 135382 | memcpy(&colordata[(q+3)*48], &colordata[8*48], 48); | |
| 19346 | 135382 | q+=4; | |
| 19347 | 135382 | } | |
| 19348 | else | ||
| 19349 | { | ||
| 19350 | ✗ | for(int m = 0; m < 4; ++m) | |
| 19351 | { | ||
| 19352 | ✗ | memset(temp_colordata, 0, 48); | |
| 19353 | ✗ | if(!pfread(temp_colordata,48,f)) | |
| 19354 | { | ||
| 19355 | ✗ | return qe_invalid; | |
| 19356 | } | ||
| 19357 | ✗ | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 19358 | ✗ | ++q; | |
| 19359 | ✗ | } | |
| 19360 | } | ||
| 19361 | 135382 | } | |
| 19362 | 1773824 | ++p; | |
| 19363 | 1773824 | } | |
| 19364 | |||
| 19365 | //By this point, q should be about equal to pdTOTAL255. If it isn't, I've fucked up. -Deedee | ||
| 19366 | } | ||
| 19367 | } | ||
| 19368 | 615 | } | |
| 19369 | else | ||
| 19370 | { | ||
| 19371 |
2/2✓ Branch 0 taken 1881035 times.
✓ Branch 1 taken 215 times.
|
1881250 | for(int32_t i=0; i<pdTOTAL255; ++i) |
| 19372 | { | ||
| 19373 | 1881035 | memset(temp_colordata, 0, 48); | |
| 19374 | |||
| 19375 |
2/4✓ Branch 0 taken 1881035 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1881035 times.
✗ Branch 3 not taken.
|
1881035 | if(!pfread(temp_colordata,48,f)) |
| 19376 | { | ||
| 19377 | ✗ | return qe_invalid; | |
| 19378 | } | ||
| 19379 | |||
| 19380 | 1881035 | memcpy(&colordata[i*48], temp_colordata, 48); | |
| 19381 | 1881035 | } | |
| 19382 | } | ||
| 19383 | |||
| 19384 |
4/4✓ Branch 0 taken 829 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 169 times.
✓ Branch 3 taken 660 times.
|
830 | if (!should_skip && s_version < 6) |
| 19385 | { | ||
| 19386 |
2/2✓ Branch 0 taken 277168320 times.
✓ Branch 1 taken 660 times.
|
277168980 | for (int i = 0; i < psTOTAL255; i++) |
| 19387 | { | ||
| 19388 | 277168320 | colordata[i] = _rgb_scale_6[colordata[i]]; | |
| 19389 | 277168320 | } | |
| 19390 | 660 | } | |
| 19391 | |||
| 19392 |
5/6✓ Branch 0 taken 812 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 806 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
|
830 | if((version < 0x192)||((version == 0x192)&&(build<76))) |
| 19393 | { | ||
| 19394 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | if (!should_skip) |
| 19395 | 18 | init_palnames(); | |
| 19396 | 18 | } | |
| 19397 | else | ||
| 19398 | { | ||
| 19399 | 812 | int32_t palnamestoread = 0; | |
| 19400 | |||
| 19401 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 748 times.
|
812 | if(s_version < 3) |
| 19402 | 64 | palnamestoread = OLDMAXLEVELS; | |
| 19403 | else | ||
| 19404 | 748 | palnamestoread = 512; | |
| 19405 | |||
| 19406 |
2/2✓ Branch 0 taken 399360 times.
✓ Branch 1 taken 812 times.
|
400172 | for(int32_t i=0; i<palnamestoread; ++i) |
| 19407 | { | ||
| 19408 |
2/4✓ Branch 0 taken 399360 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 399360 times.
✗ Branch 3 not taken.
|
399360 | if(!p_getstr(temp_palname,PALNAMESIZE,f)) |
| 19409 | { | ||
| 19410 | ✗ | return qe_invalid; | |
| 19411 | } | ||
| 19412 | |||
| 19413 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 399104 times.
|
399360 | if (!should_skip) |
| 19414 | 399104 | memcpy(palnames[i], temp_palname, PALNAMESIZE); | |
| 19415 | 399360 | } | |
| 19416 | |||
| 19417 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 811 times.
|
812 | if (should_skip) |
| 19418 | 1 | return 0; | |
| 19419 | |||
| 19420 |
2/2✓ Branch 0 taken 16128 times.
✓ Branch 1 taken 811 times.
|
16939 | for(int32_t i=palnamestoread; i<MAXLEVELS; i++) |
| 19421 | { | ||
| 19422 | 16128 | memset(palnames[i], 0, PALNAMESIZE); | |
| 19423 | 16128 | } | |
| 19424 | } | ||
| 19425 | |||
| 19426 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 806 times.
|
829 | if(version > 0x192) |
| 19427 | { | ||
| 19428 |
2/2✓ Branch 0 taken 806 times.
✓ Branch 1 taken 206336 times.
|
207142 | for(int32_t i=0; i<256; i++) |
| 19429 | { | ||
| 19430 |
2/2✓ Branch 0 taken 619008 times.
✓ Branch 1 taken 206336 times.
|
825344 | for(int32_t j=0; j<3; j++) |
| 19431 | { | ||
| 19432 | 619008 | temp_misc.cycles[i][j].first=0; | |
| 19433 | 619008 | temp_misc.cycles[i][j].count=0; | |
| 19434 | 619008 | temp_misc.cycles[i][j].speed=0; | |
| 19435 | 619008 | } | |
| 19436 | 206336 | } | |
| 19437 | |||
| 19438 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_igetw(&palcycles,f)) |
| 19439 | { | ||
| 19440 | ✗ | return qe_invalid; | |
| 19441 | } | ||
| 19442 | |||
| 19443 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 806 times.
|
806 | if (palcycles > NUM_PAL_CYCLES) |
| 19444 | { | ||
| 19445 | ✗ | return qe_invalid; | |
| 19446 | } | ||
| 19447 | |||
| 19448 |
2/2✓ Branch 0 taken 806 times.
✓ Branch 1 taken 22433 times.
|
23239 | for(int32_t i=0; i<palcycles; i++) |
| 19449 | { | ||
| 19450 |
2/2✓ Branch 0 taken 67299 times.
✓ Branch 1 taken 22433 times.
|
89732 | for(int32_t j=0; j<3; j++) |
| 19451 | { | ||
| 19452 |
2/4✓ Branch 0 taken 67299 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 67299 times.
✗ Branch 3 not taken.
|
67299 | if(!p_getc(&temp_misc.cycles[i][j].first,f)) |
| 19453 | { | ||
| 19454 | ✗ | return qe_invalid; | |
| 19455 | } | ||
| 19456 | 67299 | } | |
| 19457 | |||
| 19458 |
2/2✓ Branch 0 taken 67299 times.
✓ Branch 1 taken 22433 times.
|
89732 | for(int32_t j=0; j<3; j++) |
| 19459 | { | ||
| 19460 |
2/4✓ Branch 0 taken 67299 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 67299 times.
✗ Branch 3 not taken.
|
67299 | if(!p_getc(&temp_misc.cycles[i][j].count,f)) |
| 19461 | { | ||
| 19462 | ✗ | return qe_invalid; | |
| 19463 | } | ||
| 19464 | 67299 | } | |
| 19465 | |||
| 19466 |
2/2✓ Branch 0 taken 67299 times.
✓ Branch 1 taken 22433 times.
|
89732 | for(int32_t j=0; j<3; j++) |
| 19467 | { | ||
| 19468 |
2/4✓ Branch 0 taken 67299 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 67299 times.
✗ Branch 3 not taken.
|
67299 | if(!p_getc(&temp_misc.cycles[i][j].speed,f)) |
| 19469 | { | ||
| 19470 | ✗ | return qe_invalid; | |
| 19471 | } | ||
| 19472 | 67299 | } | |
| 19473 | 22433 | } | |
| 19474 | |||
| 19475 |
1/2✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
|
806 | *Misc = temp_misc; |
| 19476 | 806 | } | |
| 19477 | |||
| 19478 | 829 | return 0; | |
| 19479 | 830 | } | |
| 19480 | |||
| 19481 | 830 | int32_t readtiles(PACKFILE *f, tiledata *buf, zquestheader *Header, word version, word build, word start_tile, int32_t max_tiles, bool from_init) | |
| 19482 | { | ||
| 19483 |
2/2✓ Branch 0 taken 806 times.
✓ Branch 1 taken 24 times.
|
830 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_tiles); |
| 19484 | |||
| 19485 | 830 | int32_t tiles_used=0; | |
| 19486 | 830 | word section_version = 0; | |
| 19487 | 830 | int32_t section_size= 0; | |
| 19488 | 830 | byte *temp_tile = new byte[tilesize(tf32Bit)]; | |
| 19489 | |||
| 19490 | //Tile Expansion | ||
| 19491 | //if ( version >= 0x254 && build >= 41 ) | ||
| 19492 |
4/4✓ Branch 0 taken 615 times.
✓ Branch 1 taken 215 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 609 times.
|
830 | if (version < 0x254 && build < 41) |
| 19493 | { | ||
| 19494 | 609 | max_tiles = ZC250MAXTILES; | |
| 19495 | 609 | } | |
| 19496 | |||
| 19497 | |||
| 19498 |
2/6✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 830 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
830 | if(Header!=NULL&&(!Header->data_flags[ZQ_TILES]&&!from_init)) //keep for old quests |
| 19499 | { | ||
| 19500 | ✗ | if(!init_tiles_for_190(true, Header)) | |
| 19501 | { | ||
| 19502 | ✗ | al_trace("Unable to initialize tiles\n"); | |
| 19503 | ✗ | } | |
| 19504 | |||
| 19505 | ✗ | delete[] temp_tile; | |
| 19506 | ✗ | temp_tile=NULL; | |
| 19507 | ✗ | return 0; | |
| 19508 | } | ||
| 19509 | else | ||
| 19510 | { | ||
| 19511 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 806 times.
|
830 | if(version > 0x192) |
| 19512 | { | ||
| 19513 | //section version info | ||
| 19514 |
1/2✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
|
806 | if(!p_igetw(§ion_version,f)) |
| 19515 | { | ||
| 19516 | ✗ | delete[] temp_tile; | |
| 19517 | ✗ | return qe_invalid; | |
| 19518 | } | ||
| 19519 | |||
| 19520 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 806 times.
|
806 | if (section_version > V_TILES) |
| 19521 | ✗ | return qe_version; | |
| 19522 | |||
| 19523 | 806 | FFCore.quest_format[vTiles] = section_version; | |
| 19524 | |||
| 19525 |
1/2✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
|
806 | if(!read_deprecated_section_cversion(f)) |
| 19526 | { | ||
| 19527 | ✗ | delete[] temp_tile; | |
| 19528 | ✗ | return qe_invalid; | |
| 19529 | } | ||
| 19530 | |||
| 19531 | //section size | ||
| 19532 |
1/2✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
|
806 | if(!p_igetl(§ion_size,f)) |
| 19533 | { | ||
| 19534 | ✗ | delete[] temp_tile; | |
| 19535 | ✗ | return qe_invalid; | |
| 19536 | } | ||
| 19537 | 806 | } | |
| 19538 | |||
| 19539 | //if ( build < 41 ) | ||
| 19540 | //{ | ||
| 19541 | // tiles_used = ZC250MAXTILES; | ||
| 19542 | //} | ||
| 19543 | |||
| 19544 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 830 times.
|
830 | if(version < 0x174) |
| 19545 | { | ||
| 19546 | ✗ | tiles_used=TILES_PER_PAGE*4; | |
| 19547 | ✗ | } //no expanded tile space | |
| 19548 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 812 times.
|
830 | else if(version < 0x191) |
| 19549 | { | ||
| 19550 | 18 | tiles_used=OLDMAXTILES; | |
| 19551 | 18 | } | |
| 19552 | else | ||
| 19553 | { | ||
| 19554 | //finally... section data | ||
| 19555 |
3/4✓ Branch 0 taken 215 times.
✓ Branch 1 taken 597 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 215 times.
|
812 | if ( version >= 0x254 && build >= 41 ) //read and write the size of tiles_used properly |
| 19556 | { | ||
| 19557 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | if(!p_igetl(&tiles_used,f)) |
| 19558 | { | ||
| 19559 | ✗ | delete[] temp_tile; | |
| 19560 | ✗ | return qe_invalid; | |
| 19561 | } | ||
| 19562 | 215 | } | |
| 19563 | else | ||
| 19564 | { | ||
| 19565 |
1/2✓ Branch 0 taken 597 times.
✗ Branch 1 not taken.
|
597 | if(!p_igetw(&tiles_used,f)) |
| 19566 | { | ||
| 19567 | ✗ | delete[] temp_tile; | |
| 19568 | ✗ | return qe_invalid; | |
| 19569 | } | ||
| 19570 | } | ||
| 19571 | } | ||
| 19572 | |||
| 19573 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | tiles_used=zc_min(tiles_used, max_tiles); |
| 19574 | |||
| 19575 | //if ( version < 0x254 || ( version >= 0x254 && build < 41 )) //don't do this, it crashes ZQuest. -Z | ||
| 19576 | //if ( version < 0x254 && build < 41 ) | ||
| 19577 |
3/6✓ Branch 0 taken 215 times.
✓ Branch 1 taken 615 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 215 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
830 | if ( version < 0x254 || (version == 0x254 && build < 41) ) |
| 19578 | //if ( build < 41 ) | ||
| 19579 | { | ||
| 19580 |
1/2✓ Branch 0 taken 615 times.
✗ Branch 1 not taken.
|
615 | tiles_used=zc_min(tiles_used, ZC250MAXTILES-start_tile); |
| 19581 | 615 | } | |
| 19582 | else //2.55 | ||
| 19583 | { | ||
| 19584 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | tiles_used = zc_min(tiles_used,NEWMAXTILES-start_tile); |
| 19585 | } | ||
| 19586 | |||
| 19587 | //if ( section_version > 1 ) tiles_used = NEWMAXTILES; | ||
| 19588 | |||
| 19589 | |||
| 19590 |
2/2✓ Branch 0 taken 19259896 times.
✓ Branch 1 taken 830 times.
|
19260726 | for(int32_t i=0; i<tiles_used; ++i) |
| 19591 | { | ||
| 19592 | 19259896 | byte format=tf4Bit; | |
| 19593 | 19259896 | memset(temp_tile, 0, tilesize(tf32Bit)); | |
| 19594 | |||
| 19595 |
3/6✓ Branch 0 taken 2919950 times.
✓ Branch 1 taken 16339946 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2919950 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
19259896 | if((version>0x211)||((version==0x211)&&(build>4))) |
| 19596 | { | ||
| 19597 |
1/2✓ Branch 0 taken 16339946 times.
✗ Branch 1 not taken.
|
16339946 | if(!p_getc(&format,f)) |
| 19598 | { | ||
| 19599 | ✗ | delete[] temp_tile; | |
| 19600 | ✗ | return qe_invalid; | |
| 19601 | } | ||
| 19602 | 16339946 | } | |
| 19603 |
4/4✓ Branch 0 taken 8379212 times.
✓ Branch 1 taken 10880684 times.
✓ Branch 2 taken 3872904 times.
✓ Branch 3 taken 4506308 times.
|
19259896 | if(section_version > 2 && !format) |
| 19604 | { | ||
| 19605 | 4506308 | reset_tile(buf,start_tile+i,tf4Bit); | |
| 19606 | 4506308 | continue; | |
| 19607 | } | ||
| 19608 | |||
| 19609 |
2/2✓ Branch 0 taken 14244318 times.
✓ Branch 1 taken 509270 times.
|
14753588 | int size = format == tf4Bit ? 128 : tilesize(format); |
| 19610 |
1/2✓ Branch 0 taken 14753588 times.
✗ Branch 1 not taken.
|
14753588 | if(!pfread(temp_tile,size,f)) |
| 19611 | { | ||
| 19612 | ✗ | delete[] temp_tile; | |
| 19613 | ✗ | return qe_invalid; | |
| 19614 | } | ||
| 19615 | |||
| 19616 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14753588 times.
|
14753588 | if (should_skip) |
| 19617 | ✗ | continue; | |
| 19618 | |||
| 19619 | 14753588 | buf[start_tile+i].format=format; | |
| 19620 | |||
| 19621 |
2/2✓ Branch 0 taken 14539914 times.
✓ Branch 1 taken 213674 times.
|
14753588 | if(buf[start_tile+i].data) |
| 19622 | { | ||
| 19623 | 14539914 | free(buf[start_tile+i].data); | |
| 19624 | 14539914 | buf[start_tile+i].data=NULL; | |
| 19625 | 14539914 | } | |
| 19626 | |||
| 19627 | 14753588 | buf[start_tile+i].data=(byte *)malloc(tilesize(buf[start_tile+i].format)); | |
| 19628 | |||
| 19629 |
2/2✓ Branch 0 taken 14244318 times.
✓ Branch 1 taken 509270 times.
|
14753588 | if (format == tf4Bit) |
| 19630 | { | ||
| 19631 | byte temp[256]; | ||
| 19632 | 14244318 | byte *si = temp_tile + 128; | |
| 19633 | 14244318 | byte *di = temp + 256; | |
| 19634 | |||
| 19635 |
2/2✓ Branch 0 taken 1823272704 times.
✓ Branch 1 taken 14244318 times.
|
1837517022 | for(int i=127; i>=0; --i) |
| 19636 | { | ||
| 19637 | 1823272704 | (*(--di)) = (*(--si)) >> 4; | |
| 19638 | 1823272704 | (*(--di)) = (*si) & 15; | |
| 19639 | 1823272704 | } | |
| 19640 | |||
| 19641 | 14244318 | memcpy(buf[start_tile+i].data,temp,256); | |
| 19642 | 14244318 | } | |
| 19643 | else | ||
| 19644 | { | ||
| 19645 | 509270 | memcpy(buf[start_tile+i].data,temp_tile,tilesize(buf[start_tile+i].format)); | |
| 19646 | } | ||
| 19647 | 14753588 | } | |
| 19648 | } | ||
| 19649 | |||
| 19650 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 830 times.
|
830 | if (should_skip) |
| 19651 | ✗ | return 0; | |
| 19652 | |||
| 19653 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 615 times.
|
830 | if ( section_version < 2 ) //write blank tile data --check s_version with this again instead? |
| 19654 | { | ||
| 19655 |
2/2✓ Branch 0 taken 91622700 times.
✓ Branch 1 taken 615 times.
|
91623315 | for ( int32_t q = ZC250MAXTILES; q < NEWMAXTILES; ++q ) |
| 19656 | { | ||
| 19657 | |||
| 19658 | //memcpy(buf[q].data,temp_tile,tilesize(buf[q].format)); | ||
| 19659 | 91622700 | reset_tile(buf,q,tf4Bit); | |
| 19660 | |||
| 19661 | |||
| 19662 | /* | ||
| 19663 | |||
| 19664 | byte tempbyte; | ||
| 19665 | for(int32_t i=0; i<tilesize(tf4Bit); i++) | ||
| 19666 | { | ||
| 19667 | tempbyte=buf[ZC250MAXTILES-1].data[i]; | ||
| 19668 | buf[q].data[i] = tempbyte; | ||
| 19669 | } | ||
| 19670 | //int32_t temp = tempbyte=buf[130].data[i]; | ||
| 19671 | //buf[q].data = buf[ZC250MAXTILES-1].data; | ||
| 19672 | */ | ||
| 19673 | //reset_tile(buf,q,tf4Bit); | ||
| 19674 | 91622700 | } | |
| 19675 | |||
| 19676 | 615 | } | |
| 19677 | |||
| 19678 |
4/6✓ Branch 0 taken 215 times.
✓ Branch 1 taken 615 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 215 times.
|
830 | if ( version < 0x254 || ( version >= 0x254 && build < 41 )) |
| 19679 | { | ||
| 19680 |
2/2✓ Branch 0 taken 30881712 times.
✓ Branch 1 taken 615 times.
|
30882327 | for(int32_t i=start_tile+tiles_used; i<max_tiles; ++i) |
| 19681 | { | ||
| 19682 | 30881712 | reset_tile(buf,i,tf4Bit); | |
| 19683 | 30881712 | } | |
| 19684 | 615 | } | |
| 19685 | else | ||
| 19686 | { | ||
| 19687 |
2/2✓ Branch 0 taken 37164572 times.
✓ Branch 1 taken 215 times.
|
37164787 | for(int32_t i=start_tile+tiles_used; i<max_tiles; ++i) |
| 19688 | { | ||
| 19689 | 37164572 | reset_tile(buf,i,tf4Bit); | |
| 19690 | 37164572 | } | |
| 19691 | } | ||
| 19692 | |||
| 19693 |
5/6✓ Branch 0 taken 812 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 806 times.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
830 | if((version < 0x192)|| ((version == 0x192)&&(build<186))) |
| 19694 | { | ||
| 19695 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 6 times.
|
24 | if(get_qr(qr_BSZELDA)) // |
| 19696 | { | ||
| 19697 | byte tempbyte; | ||
| 19698 | 6 | int32_t floattile=wpnsbuf[iwSwim].tile; | |
| 19699 | |||
| 19700 |
2/2✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 6 times.
|
1542 | for(int32_t i=0; i<tilesize(tf4Bit); i++) //BSZelda tiles are out of order //does this include swim tiles? |
| 19701 | { | ||
| 19702 | 1536 | tempbyte=buf[23].data[i]; | |
| 19703 | 1536 | buf[23].data[i]=buf[24].data[i]; | |
| 19704 | 1536 | buf[24].data[i]=buf[25].data[i]; | |
| 19705 | 1536 | buf[25].data[i]=buf[26].data[i]; | |
| 19706 | 1536 | buf[26].data[i]=tempbyte; | |
| 19707 | 1536 | } | |
| 19708 | //swim tiles are out of order, too, but nobody cared? -Z | ||
| 19709 |
2/2✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 6 times.
|
1542 | for(int32_t i=0; i<tilesize(tf4Bit); i++) |
| 19710 | { | ||
| 19711 | 1536 | tempbyte=buf[floattile+11].data[i]; | |
| 19712 | 1536 | buf[floattile+11].data[i]=buf[floattile+12].data[i]; | |
| 19713 | 1536 | buf[floattile+12].data[i]=tempbyte; | |
| 19714 | 1536 | } | |
| 19715 | 6 | } | |
| 19716 | 24 | } | |
| 19717 | |||
| 19718 |
3/6✓ Branch 0 taken 748 times.
✓ Branch 1 taken 82 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 748 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
830 | if((version < 0x211)||((version == 0x211)&&(build<7))) //Goriya tiles are out of order |
| 19719 | { | ||
| 19720 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 22 times.
|
82 | if(!get_qr(qr_NEWENEMYTILES)) |
| 19721 | { | ||
| 19722 | byte tempbyte; | ||
| 19723 | |||
| 19724 |
2/2✓ Branch 0 taken 5632 times.
✓ Branch 1 taken 22 times.
|
5654 | for(int32_t i=0; i<tilesize(tf4Bit); i++) |
| 19725 | { | ||
| 19726 | 5632 | tempbyte=buf[130].data[i]; | |
| 19727 | 5632 | buf[130].data[i]=buf[132].data[i]; | |
| 19728 | 5632 | buf[132].data[i]=tempbyte; | |
| 19729 | |||
| 19730 | 5632 | tempbyte=buf[131].data[i]; | |
| 19731 | 5632 | buf[131].data[i]=buf[133].data[i]; | |
| 19732 | 5632 | buf[133].data[i]=tempbyte; | |
| 19733 | 5632 | } | |
| 19734 | 22 | } | |
| 19735 | 82 | } | |
| 19736 | |||
| 19737 | 830 | al_trace("Registering blank tiles\n"); | |
| 19738 | 830 | register_blank_tiles(); | |
| 19739 | |||
| 19740 | //memset(temp_tile, 0, tilesize(tf32Bit)); | ||
| 19741 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | delete[] temp_tile; |
| 19742 | 830 | temp_tile=NULL; | |
| 19743 | 830 | return 0; | |
| 19744 | 830 | } | |
| 19745 | |||
| 19746 | 496 | int32_t readmidis(PACKFILE *f, zquestheader *Header, zctune *tunes /*zcmidi_ *midis*/) | |
| 19747 | { | ||
| 19748 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 473 times.
|
496 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_midis); |
| 19749 | |||
| 19750 | static byte fake_midi_flags[32]; | ||
| 19751 | |||
| 19752 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 496 times.
|
496 | byte *mf=should_skip ? fake_midi_flags : midi_flags; |
| 19753 | int32_t dummy; | ||
| 19754 | word dummy2; | ||
| 19755 | // zcmidi_ temp_midi; | ||
| 19756 | int32_t tunes_to_read; | ||
| 19757 | 496 | int32_t tune_count=0; | |
| 19758 | 496 | word section_version=0; | |
| 19759 | 496 | zctune temp; | |
| 19760 | |||
| 19761 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 473 times.
|
496 | if(Header->zelda_version < 0x193) |
| 19762 | { | ||
| 19763 | // mf=Header->data_flags+ZQ_MIDIS2; | ||
| 19764 |
5/6✓ Branch 0 taken 5 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 1 times.
|
23 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<178))) |
| 19765 | { | ||
| 19766 | 22 | tunes_to_read=MAXCUSTOMMIDIS192b177; | |
| 19767 | 22 | } | |
| 19768 | else | ||
| 19769 | { | ||
| 19770 | 1 | tunes_to_read=MAXCUSTOMTUNES; | |
| 19771 | } | ||
| 19772 | 23 | } | |
| 19773 | else | ||
| 19774 | { | ||
| 19775 | //section version info | ||
| 19776 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetw(§ion_version,f)) |
| 19777 | { | ||
| 19778 | ✗ | return qe_invalid; | |
| 19779 | } | ||
| 19780 | |||
| 19781 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if (section_version > V_MIDIS) |
| 19782 | ✗ | return qe_version; | |
| 19783 | |||
| 19784 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if (!should_skip) |
| 19785 | 473 | FFCore.quest_format[vMIDIs] = section_version; | |
| 19786 | |||
| 19787 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetw(&dummy2,f)) |
| 19788 | { | ||
| 19789 | ✗ | return qe_invalid; | |
| 19790 | } | ||
| 19791 | |||
| 19792 | //section size | ||
| 19793 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetl(&dummy,f)) |
| 19794 | { | ||
| 19795 | ✗ | return qe_invalid; | |
| 19796 | } | ||
| 19797 | |||
| 19798 | //finally... section data | ||
| 19799 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!pfread(midi_flags,sizeof(midi_flags),f)) |
| 19800 | { | ||
| 19801 | ✗ | return qe_invalid; | |
| 19802 | } | ||
| 19803 | |||
| 19804 | 473 | tunes_to_read=MAXCUSTOMTUNES; | |
| 19805 | } | ||
| 19806 | |||
| 19807 |
2/2✓ Branch 0 taken 124992 times.
✓ Branch 1 taken 496 times.
|
125488 | for(int32_t i=0; i<MAXCUSTOMTUNES; ++i) |
| 19808 | { | ||
| 19809 |
2/2✓ Branch 0 taken 10271 times.
✓ Branch 1 taken 114721 times.
|
124992 | if(get_bit(mf, i)) |
| 19810 | { | ||
| 19811 | 10271 | ++tune_count; | |
| 19812 | 10271 | } | |
| 19813 | 124992 | } | |
| 19814 | |||
| 19815 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 496 times.
|
496 | if (!should_skip) |
| 19816 | 496 | reset_tunes(tunes); //reset_midis(midis); | |
| 19817 | |||
| 19818 |
2/2✓ Branch 0 taken 120152 times.
✓ Branch 1 taken 496 times.
|
120648 | for(int32_t i=0; i<tunes_to_read; i++) |
| 19819 | { | ||
| 19820 | 120152 | temp.clear(); //memset(&temp_midi,0,sizeof(zcmidi_)); | |
| 19821 | |||
| 19822 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 120152 times.
|
120152 | if (!should_skip) |
| 19823 | 120152 | tunes[i].reset(); // reset_midi(midis+i); | |
| 19824 | |||
| 19825 |
2/2✓ Branch 0 taken 109881 times.
✓ Branch 1 taken 10271 times.
|
120152 | if(get_bit(mf,i)) |
| 19826 | { | ||
| 19827 |
2/2✓ Branch 0 taken 2603 times.
✓ Branch 1 taken 7668 times.
|
10271 | if(section_version < 4) |
| 19828 | { | ||
| 19829 |
1/2✓ Branch 0 taken 2603 times.
✗ Branch 1 not taken.
|
2603 | if(!p_getstr(temp.title,20,f)) |
| 19830 | { | ||
| 19831 | ✗ | return qe_invalid; | |
| 19832 | } | ||
| 19833 | 2603 | } | |
| 19834 | else | ||
| 19835 | { | ||
| 19836 |
1/2✓ Branch 0 taken 7668 times.
✗ Branch 1 not taken.
|
7668 | if(!p_getstr(temp.title,sizeof(temp.title)-1,f)) |
| 19837 | { | ||
| 19838 | ✗ | return qe_invalid; | |
| 19839 | } | ||
| 19840 | } | ||
| 19841 | |||
| 19842 |
1/2✓ Branch 0 taken 10271 times.
✗ Branch 1 not taken.
|
10271 | if(!p_igetl(&temp.start,f)) |
| 19843 | { | ||
| 19844 | ✗ | return qe_invalid; | |
| 19845 | } | ||
| 19846 | |||
| 19847 |
1/2✓ Branch 0 taken 10271 times.
✗ Branch 1 not taken.
|
10271 | if(!p_igetl(&temp.loop_start,f)) |
| 19848 | { | ||
| 19849 | ✗ | return qe_invalid; | |
| 19850 | } | ||
| 19851 | |||
| 19852 |
1/2✓ Branch 0 taken 10271 times.
✗ Branch 1 not taken.
|
10271 | if(!p_igetl(&temp.loop_end,f)) |
| 19853 | { | ||
| 19854 | ✗ | return qe_invalid; | |
| 19855 | } | ||
| 19856 | |||
| 19857 |
1/2✓ Branch 0 taken 10271 times.
✗ Branch 1 not taken.
|
10271 | if(!p_igetw(&temp.loop,f)) |
| 19858 | { | ||
| 19859 | ✗ | return qe_invalid; | |
| 19860 | } | ||
| 19861 | |||
| 19862 |
1/2✓ Branch 0 taken 10271 times.
✗ Branch 1 not taken.
|
10271 | if(!p_igetw(&temp.volume,f)) |
| 19863 | { | ||
| 19864 | ✗ | return qe_invalid; | |
| 19865 | } | ||
| 19866 | |||
| 19867 |
2/2✓ Branch 0 taken 10022 times.
✓ Branch 1 taken 249 times.
|
10271 | if(Header->zelda_version < 0x193) |
| 19868 | { | ||
| 19869 |
1/2✓ Branch 0 taken 249 times.
✗ Branch 1 not taken.
|
249 | if(!p_igetl(&dummy,f)) |
| 19870 | { | ||
| 19871 | ✗ | return qe_invalid; | |
| 19872 | } | ||
| 19873 | 249 | } | |
| 19874 | |||
| 19875 |
2/2✓ Branch 0 taken 2603 times.
✓ Branch 1 taken 7668 times.
|
10271 | if(section_version >= 3) |
| 19876 | { | ||
| 19877 |
1/2✓ Branch 0 taken 7668 times.
✗ Branch 1 not taken.
|
7668 | if(!pfread(&temp.flags,sizeof(temp.flags),f)) |
| 19878 | { | ||
| 19879 | ✗ | return qe_invalid; | |
| 19880 | } | ||
| 19881 | 7668 | } | |
| 19882 | |||
| 19883 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10271 times.
|
10271 | if (!should_skip) |
| 19884 | 10271 | tunes[i].copyfrom(temp); // memcpy(&midis[i], &temp_midi, sizeof(zcmidi_)); | |
| 19885 | |||
| 19886 |
2/2✓ Branch 0 taken 2603 times.
✓ Branch 1 taken 7668 times.
|
10271 | if(section_version < 2) //= 1 || (Header->zelda_version < 0x211) || (Header->zelda_version == 0x211 && Header->build < 18)) |
| 19887 | { | ||
| 19888 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2603 times.
|
2603 | if (should_skip) |
| 19889 | { | ||
| 19890 | ✗ | if (read_midi(f)==NULL) | |
| 19891 | { | ||
| 19892 | ✗ | return qe_invalid; | |
| 19893 | } | ||
| 19894 | |||
| 19895 | ✗ | continue; | |
| 19896 | } | ||
| 19897 | |||
| 19898 | // old format - a midi is a midi | ||
| 19899 |
1/2✓ Branch 0 taken 2603 times.
✗ Branch 1 not taken.
|
2603 | if((tunes[i].data=read_midi(f))==NULL) |
| 19900 | { | ||
| 19901 | ✗ | return qe_invalid; | |
| 19902 | } | ||
| 19903 | 2603 | } | |
| 19904 | else | ||
| 19905 | { | ||
| 19906 | byte format; | ||
| 19907 |
1/2✓ Branch 0 taken 7668 times.
✗ Branch 1 not taken.
|
7668 | if(!pfread(&format,sizeof(format),f)) |
| 19908 | { | ||
| 19909 | ✗ | return qe_invalid; | |
| 19910 | } | ||
| 19911 | |||
| 19912 | // MIDI is the only format saved here. | ||
| 19913 | // Never did more than MIDI for a zctune, and no plans to now. | ||
| 19914 |
1/2✓ Branch 0 taken 7668 times.
✗ Branch 1 not taken.
|
7668 | if (format != MFORMAT_MIDI) |
| 19915 | { | ||
| 19916 | ✗ | return qe_invalid; | |
| 19917 | } | ||
| 19918 | |||
| 19919 | 7668 | tunes[i].data = read_midi(f); | |
| 19920 |
1/2✓ Branch 0 taken 7668 times.
✗ Branch 1 not taken.
|
7668 | if (!tunes[i].data) |
| 19921 | { | ||
| 19922 | ✗ | return qe_invalid; | |
| 19923 | } | ||
| 19924 | } | ||
| 19925 | 10271 | } | |
| 19926 | 120152 | } | |
| 19927 | |||
| 19928 | 496 | return 0; | |
| 19929 | 496 | } | |
| 19930 | |||
| 19931 | 496 | int32_t readcheatcodes(PACKFILE *f, zquestheader *Header) | |
| 19932 | { | ||
| 19933 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 23 times.
|
496 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_cheats); |
| 19934 | |||
| 19935 | int32_t dummy; | ||
| 19936 | ZCHEATS tempzcheats; | ||
| 19937 | 496 | char temp_use_cheats=1; | |
| 19938 | 496 | memset(&tempzcheats, 0, sizeof(tempzcheats)); | |
| 19939 | 496 | word s_version = 0; | |
| 19940 | |||
| 19941 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 473 times.
|
496 | if(Header->zelda_version > 0x192) |
| 19942 | { | ||
| 19943 | //section version info | ||
| 19944 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetw(&s_version,f)) |
| 19945 | { | ||
| 19946 | ✗ | return qe_invalid; | |
| 19947 | } | ||
| 19948 | |||
| 19949 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if (s_version > V_CHEATS) |
| 19950 | ✗ | return qe_version; | |
| 19951 | |||
| 19952 | 473 | FFCore.quest_format[vCheats] = s_version; | |
| 19953 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetw(&dummy,f)) |
| 19954 | { | ||
| 19955 | ✗ | return qe_invalid; | |
| 19956 | } | ||
| 19957 | |||
| 19958 | //section size | ||
| 19959 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if(!p_igetl(&dummy,f)) |
| 19960 | { | ||
| 19961 | ✗ | return qe_invalid; | |
| 19962 | } | ||
| 19963 | |||
| 19964 | //finally... section data | ||
| 19965 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if(!p_getc(&temp_use_cheats,f)) |
| 19966 | { | ||
| 19967 | ✗ | return qe_invalid; | |
| 19968 | } | ||
| 19969 | 473 | } | |
| 19970 | |||
| 19971 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 496 times.
|
496 | if(Header->data_flags[ZQ_CHEATS2]) |
| 19972 | { | ||
| 19973 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | if(!p_igetl(&tempzcheats.flags,f)) |
| 19974 | { | ||
| 19975 | ✗ | return qe_invalid; | |
| 19976 | } | ||
| 19977 | |||
| 19978 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | if(!pfread(&tempzcheats.codes, sizeof(tempzcheats.codes),f)) |
| 19979 | { | ||
| 19980 | ✗ | return qe_invalid; | |
| 19981 | } | ||
| 19982 | 496 | } | |
| 19983 | |||
| 19984 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 496 times.
|
496 | if (should_skip) |
| 19985 | ✗ | return 0; | |
| 19986 | |||
| 19987 | 496 | memcpy(&zcheats, &tempzcheats, sizeof(tempzcheats)); | |
| 19988 | 496 | Header->data_flags[ZQ_CHEATS2]=temp_use_cheats; | |
| 19989 | |||
| 19990 | 496 | return 0; | |
| 19991 | 496 | } | |
| 19992 | |||
| 19993 | 298 | int32_t readinitdata_old(PACKFILE *f, zquestheader *Header, word s_version, zinitdata& temp_zinit) | |
| 19994 | { | ||
| 19995 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 275 times.
|
298 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_initdata); |
| 19996 | |||
| 19997 | byte padding, tempbyte; | ||
| 19998 | |||
| 19999 | // Legacy item properties (now integrated into itemdata) | ||
| 20000 | byte sword_hearts[4]; | ||
| 20001 | byte beam_hearts[4]; | ||
| 20002 | 298 | byte beam_percent=0; | |
| 20003 | word beam_power[4]; | ||
| 20004 | 298 | byte hookshot_length=99; | |
| 20005 | 298 | byte hookshot_links=100; | |
| 20006 | 298 | byte longshot_length=99; | |
| 20007 | 298 | byte longshot_links=100; | |
| 20008 | 298 | byte moving_fairy_hearts=3; | |
| 20009 | 298 | byte moving_fairy_heart_percent=0; | |
| 20010 | 298 | byte stationary_fairy_hearts=3; | |
| 20011 | 298 | byte stationary_fairy_heart_percent=0; | |
| 20012 | 298 | byte moving_fairy_magic=0; | |
| 20013 | 298 | byte moving_fairy_magic_percent=0; | |
| 20014 | 298 | byte stationary_fairy_magic=0; | |
| 20015 | 298 | byte stationary_fairy_magic_percent=0; | |
| 20016 | 298 | byte blue_potion_hearts=100; | |
| 20017 | 298 | byte blue_potion_heart_percent=1; | |
| 20018 | 298 | byte red_potion_hearts=100; | |
| 20019 | 298 | byte red_potion_heart_percent=1; | |
| 20020 | 298 | byte blue_potion_magic=100; | |
| 20021 | 298 | byte blue_potion_magic_percent=1; | |
| 20022 | 298 | byte red_potion_magic=100; | |
| 20023 | 298 | byte red_potion_magic_percent=1; | |
| 20024 | |||
| 20025 | 298 | byte bomb_ratio = 4; | |
| 20026 | |||
| 20027 | 298 | subscr_mode = 0; | |
| 20028 | |||
| 20029 | /* HIGHLY UNORTHODOX UPDATING THING, by L | ||
| 20030 | * This fixes quests made before revision 277 (such as the 'Lost Isle Build'), | ||
| 20031 | * where the speed of Pols Voice changed. It also coincided with V_INITDATA | ||
| 20032 | * changing from 13 to 14. | ||
| 20033 | */ | ||
| 20034 |
2/2✓ Branch 0 taken 217 times.
✓ Branch 1 taken 81 times.
|
298 | if(s_version < 14) |
| 20035 | 81 | fixpolsvoice=true; | |
| 20036 | |||
| 20037 | /* End highly unorthodox updating thing */ | ||
| 20038 | |||
| 20039 |
4/4✓ Branch 0 taken 217 times.
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 106 times.
✓ Branch 3 taken 111 times.
|
298 | if(s_version >= 15 && get_bit(deprecated_rules, 27)) // The int16_t-lived rule, qr_JUMPHEROLAYER3 |
| 20040 | 111 | temp_zinit.jump_hero_layer_threshold=0; | |
| 20041 | |||
| 20042 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 217 times.
|
298 | if(s_version >= 10) |
| 20043 | { | ||
| 20044 | char temp; | ||
| 20045 | |||
| 20046 | //new-style items | ||
| 20047 |
2/2✓ Branch 0 taken 55552 times.
✓ Branch 1 taken 217 times.
|
55769 | for(int32_t j=0; j<256; j++) |
| 20048 | { | ||
| 20049 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55552 times.
|
55552 | if(!p_getc(&temp,f)) |
| 20050 | ✗ | return qe_invalid; | |
| 20051 | |||
| 20052 | 55552 | temp_zinit.set_item(j, temp != 0); | |
| 20053 | 55552 | } | |
| 20054 | 217 | } | |
| 20055 | |||
| 20056 |
5/6✓ Branch 0 taken 23 times.
✓ Branch 1 taken 275 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 18 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
298 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>26))) |
| 20057 | { | ||
| 20058 | char temp; | ||
| 20059 | |||
| 20060 | //finally... section data | ||
| 20061 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 275 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
285 | if((Header->zelda_version > 0x192)|| |
| 20062 | //new only | ||
| 20063 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | ((Header->zelda_version == 0x192)&&(Header->build>173))) |
| 20064 | { | ||
| 20065 | //OLD-style items... sigh | ||
| 20066 |
2/2✓ Branch 0 taken 217 times.
✓ Branch 1 taken 59 times.
|
276 | if(s_version < 10) |
| 20067 | { | ||
| 20068 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_getc(&temp,f)) |
| 20069 | { | ||
| 20070 | ✗ | return qe_invalid; | |
| 20071 | } | ||
| 20072 | |||
| 20073 | 59 | temp_zinit.set_item(iRaft, temp != 0); | |
| 20074 | |||
| 20075 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_getc(&temp,f)) |
| 20076 | { | ||
| 20077 | ✗ | return qe_invalid; | |
| 20078 | } | ||
| 20079 | |||
| 20080 | 59 | temp_zinit.set_item(iLadder, temp != 0); | |
| 20081 | |||
| 20082 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_getc(&temp,f)) |
| 20083 | { | ||
| 20084 | ✗ | return qe_invalid; | |
| 20085 | } | ||
| 20086 | |||
| 20087 | 59 | temp_zinit.set_item(iBook, temp != 0); | |
| 20088 | |||
| 20089 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_getc(&temp,f)) |
| 20090 | { | ||
| 20091 | ✗ | return qe_invalid; | |
| 20092 | } | ||
| 20093 | |||
| 20094 | 59 | temp_zinit.set_item(iMKey, temp != 0); | |
| 20095 | |||
| 20096 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_getc(&temp,f)) |
| 20097 | { | ||
| 20098 | ✗ | return qe_invalid; | |
| 20099 | } | ||
| 20100 | |||
| 20101 | 59 | temp_zinit.set_item(iFlippers, temp != 0); | |
| 20102 | |||
| 20103 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_getc(&temp,f)) |
| 20104 | { | ||
| 20105 | ✗ | return qe_invalid; | |
| 20106 | } | ||
| 20107 | |||
| 20108 | 59 | temp_zinit.set_item(iBoots, temp != 0); | |
| 20109 | 59 | } | |
| 20110 | 276 | } | |
| 20111 | |||
| 20112 |
2/2✓ Branch 0 taken 217 times.
✓ Branch 1 taken 63 times.
|
280 | if(s_version < 10) |
| 20113 | { | ||
| 20114 | char tempring, tempsword, tempshield, tempwallet, tempbracelet, tempamulet, tempbow; | ||
| 20115 | |||
| 20116 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(!p_getc(&tempring,f)) |
| 20117 | { | ||
| 20118 | ✗ | return qe_invalid; | |
| 20119 | } | ||
| 20120 | |||
| 20121 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(!p_getc(&tempsword,f)) |
| 20122 | { | ||
| 20123 | ✗ | return qe_invalid; | |
| 20124 | } | ||
| 20125 | |||
| 20126 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(!p_getc(&tempshield,f)) |
| 20127 | { | ||
| 20128 | ✗ | return qe_invalid; | |
| 20129 | } | ||
| 20130 | |||
| 20131 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(!p_getc(&tempwallet,f)) |
| 20132 | { | ||
| 20133 | ✗ | return qe_invalid; | |
| 20134 | } | ||
| 20135 | |||
| 20136 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(!p_getc(&tempbracelet,f)) |
| 20137 | { | ||
| 20138 | ✗ | return qe_invalid; | |
| 20139 | } | ||
| 20140 | |||
| 20141 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(!p_getc(&tempamulet,f)) |
| 20142 | { | ||
| 20143 | ✗ | return qe_invalid; | |
| 20144 | } | ||
| 20145 | |||
| 20146 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(!p_getc(&tempbow,f)) |
| 20147 | { | ||
| 20148 | ✗ | return qe_invalid; | |
| 20149 | } | ||
| 20150 | |||
| 20151 | //old only | ||
| 20152 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 58 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
63 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 20153 | { | ||
| 20154 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempring=(tempring)?(1<<(tempring-1)):0; |
| 20155 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempsword=(tempsword)?(1<<(tempsword-1)):0; |
| 20156 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | tempshield=(tempshield)?(1<<(tempshield-1)):0; |
| 20157 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempwallet=(tempwallet)?(1<<(tempwallet-1)):0; |
| 20158 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempbracelet=(tempbracelet)?(1<<(tempbracelet-1)):0; |
| 20159 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempamulet=(tempamulet)?(1<<(tempamulet-1)):0; |
| 20160 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempbow=(tempbow)?(1<<(tempbow-1)):0; |
| 20161 | 4 | } | |
| 20162 | |||
| 20163 | //rings start at level 2... wtf | ||
| 20164 | //account for this -DD | ||
| 20165 | 63 | tempring <<= 1; | |
| 20166 | 63 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_ring, tempring); | |
| 20167 | 63 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_sword, tempsword); | |
| 20168 | 63 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_shield, tempshield); | |
| 20169 | 63 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_wallet, tempwallet); | |
| 20170 | //bracelet ALSO starts at level 2 :-( -DD | ||
| 20171 | 63 | tempbracelet<<=1; | |
| 20172 | 63 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_bracelet, tempbracelet); | |
| 20173 | 63 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_amulet, tempamulet); | |
| 20174 | 63 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_bow, tempbow); | |
| 20175 | |||
| 20176 | //new only | ||
| 20177 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 58 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 1 times.
|
63 | if((Header->zelda_version == 0x192)&&(Header->build>173)) |
| 20178 | { | ||
| 20179 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 1 times.
|
33 | for(int32_t q=0; q<32; q++) |
| 20180 | { | ||
| 20181 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&padding,f)) |
| 20182 | { | ||
| 20183 | ✗ | return qe_invalid; | |
| 20184 | } | ||
| 20185 | 32 | } | |
| 20186 | 1 | } | |
| 20187 | |||
| 20188 | char tempcandle, tempboomerang, temparrow, tempwhistle; | ||
| 20189 | |||
| 20190 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(!p_getc(&tempcandle,f)) |
| 20191 | { | ||
| 20192 | ✗ | return qe_invalid; | |
| 20193 | } | ||
| 20194 | |||
| 20195 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(!p_getc(&tempboomerang,f)) |
| 20196 | { | ||
| 20197 | ✗ | return qe_invalid; | |
| 20198 | } | ||
| 20199 | |||
| 20200 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(!p_getc(&temparrow,f)) |
| 20201 | { | ||
| 20202 | ✗ | return qe_invalid; | |
| 20203 | } | ||
| 20204 | |||
| 20205 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(!p_getc(&temp,f)) |
| 20206 | { | ||
| 20207 | ✗ | return qe_invalid; | |
| 20208 | } | ||
| 20209 | |||
| 20210 | 63 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_potion, temp); | |
| 20211 | |||
| 20212 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(!p_getc(&tempwhistle,f)) |
| 20213 | { | ||
| 20214 | ✗ | return qe_invalid; | |
| 20215 | } | ||
| 20216 | |||
| 20217 | //old only | ||
| 20218 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 58 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
63 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 20219 | { | ||
| 20220 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempcandle=(tempcandle)?(1<<(tempcandle-1)):0; |
| 20221 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempboomerang=(tempboomerang)?(1<<(tempboomerang-1)):0; |
| 20222 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | temparrow=(temparrow)?(1<<(temparrow-1)):0; |
| 20223 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempwhistle=(tempwhistle)?(1<<(tempwhistle-1)):0; |
| 20224 | 4 | } | |
| 20225 | |||
| 20226 | 63 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_candle, tempcandle); | |
| 20227 | 63 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_brang, tempboomerang); | |
| 20228 | 63 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_arrow, temparrow); | |
| 20229 | 63 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_whistle, tempwhistle); | |
| 20230 | //What about the potion...? | ||
| 20231 | |||
| 20232 | 63 | } | |
| 20233 | |||
| 20234 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 263 times.
|
280 | if(s_version < 29) |
| 20235 | { | ||
| 20236 | //Oh sure, stick these IN THE MIDDLE OF THE ITEMS, just to make me want | ||
| 20237 | //to jab out my eye... | ||
| 20238 |
1/2✓ Branch 0 taken 263 times.
✗ Branch 1 not taken.
|
263 | if(!p_getc(&padding,f)) |
| 20239 | ✗ | return qe_invalid; | |
| 20240 | 263 | temp_zinit.counter[crBOMBS] = padding; | |
| 20241 | |||
| 20242 |
1/2✓ Branch 0 taken 263 times.
✗ Branch 1 not taken.
|
263 | if(!p_getc(&padding,f)) |
| 20243 | ✗ | return qe_invalid; | |
| 20244 | 263 | temp_zinit.counter[crSBOMBS] = padding; | |
| 20245 | 263 | } | |
| 20246 | |||
| 20247 | //Back to more OLD item code | ||
| 20248 |
2/2✓ Branch 0 taken 217 times.
✓ Branch 1 taken 63 times.
|
280 | if(s_version < 10) |
| 20249 | { | ||
| 20250 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 58 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
68 | if((Header->zelda_version > 0x192)|| |
| 20251 | //new only | ||
| 20252 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | ((Header->zelda_version == 0x192)&&(Header->build>173))) |
| 20253 | { | ||
| 20254 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_getc(&temp,f)) |
| 20255 | { | ||
| 20256 | ✗ | return qe_invalid; | |
| 20257 | } | ||
| 20258 | |||
| 20259 | 59 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_wand, temp); | |
| 20260 | |||
| 20261 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_getc(&temp,f)) |
| 20262 | { | ||
| 20263 | ✗ | return qe_invalid; | |
| 20264 | } | ||
| 20265 | |||
| 20266 | 59 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_letter, temp); | |
| 20267 | |||
| 20268 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_getc(&temp,f)) |
| 20269 | { | ||
| 20270 | ✗ | return qe_invalid; | |
| 20271 | } | ||
| 20272 | |||
| 20273 | 59 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_lens, temp); | |
| 20274 | |||
| 20275 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_getc(&temp,f)) |
| 20276 | { | ||
| 20277 | ✗ | return qe_invalid; | |
| 20278 | } | ||
| 20279 | |||
| 20280 | 59 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_hookshot, temp); | |
| 20281 | |||
| 20282 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_getc(&temp,f)) |
| 20283 | { | ||
| 20284 | ✗ | return qe_invalid; | |
| 20285 | } | ||
| 20286 | |||
| 20287 | 59 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_bait, temp); | |
| 20288 | |||
| 20289 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_getc(&temp,f)) |
| 20290 | { | ||
| 20291 | ✗ | return qe_invalid; | |
| 20292 | } | ||
| 20293 | |||
| 20294 | 59 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_hammer, temp); | |
| 20295 | |||
| 20296 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_getc(&temp,f)) |
| 20297 | { | ||
| 20298 | ✗ | return qe_invalid; | |
| 20299 | } | ||
| 20300 | |||
| 20301 | 59 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_divinefire, temp); | |
| 20302 | |||
| 20303 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_getc(&temp,f)) |
| 20304 | { | ||
| 20305 | ✗ | return qe_invalid; | |
| 20306 | } | ||
| 20307 | |||
| 20308 | 59 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_divineescape, temp); | |
| 20309 | |||
| 20310 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_getc(&temp,f)) |
| 20311 | { | ||
| 20312 | ✗ | return qe_invalid; | |
| 20313 | } | ||
| 20314 | |||
| 20315 | 59 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_divineprotection, temp); | |
| 20316 | |||
| 20317 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_getc(&temp,f)) |
| 20318 | { | ||
| 20319 | ✗ | return qe_invalid; | |
| 20320 | } | ||
| 20321 | |||
| 20322 |
2/2✓ Branch 0 taken 58 times.
✓ Branch 1 taken 1 times.
|
59 | if(Header->zelda_version == 0x192) |
| 20323 | { | ||
| 20324 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 1 times.
|
33 | for(int32_t q=0; q<32; q++) |
| 20325 | { | ||
| 20326 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&padding,f)) |
| 20327 | { | ||
| 20328 | ✗ | return qe_invalid; | |
| 20329 | } | ||
| 20330 | 32 | } | |
| 20331 | 1 | } | |
| 20332 | 59 | } | |
| 20333 | 63 | } | |
| 20334 | |||
| 20335 | //old only | ||
| 20336 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 275 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
280 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 20337 | { | ||
| 20338 | byte equipment, tmpitm; //bit flags | ||
| 20339 | |||
| 20340 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if(!p_getc(&equipment,f)) |
| 20341 | { | ||
| 20342 | ✗ | return qe_invalid; | |
| 20343 | } | ||
| 20344 | |||
| 20345 | 4 | temp_zinit.set_item(iRaft, get_bit(&equipment, idE_RAFT)!=0); | |
| 20346 | 4 | temp_zinit.set_item(iLadder, get_bit(&equipment, idE_LADDER)!=0); | |
| 20347 | 4 | temp_zinit.set_item(iBook, get_bit(&equipment, idE_BOOK)!=0); | |
| 20348 | 4 | temp_zinit.set_item(iMKey, get_bit(&equipment, idE_KEY)!=0); | |
| 20349 | 4 | temp_zinit.set_item(iFlippers, get_bit(&equipment, idE_FLIPPERS)!=0); | |
| 20350 | 4 | temp_zinit.set_item(iBoots, get_bit(&equipment, idE_BOOTS)!=0); | |
| 20351 | |||
| 20352 | |||
| 20353 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if(!p_getc(&tmpitm,f)) |
| 20354 | { | ||
| 20355 | ✗ | return qe_invalid; | |
| 20356 | } | ||
| 20357 | |||
| 20358 | 4 | temp_zinit.set_item(iWand, get_bit(&tmpitm, idI_WAND)!=0); | |
| 20359 | 4 | temp_zinit.set_item(iLetter, get_bit(&tmpitm, idI_LETTER)!=0); | |
| 20360 | 4 | temp_zinit.set_item(iLens, get_bit(&tmpitm, idI_LENS)!=0); | |
| 20361 | 4 | temp_zinit.set_item(iHookshot, get_bit(&tmpitm, idI_HOOKSHOT)!=0); | |
| 20362 | 4 | temp_zinit.set_item(iBait, get_bit(&tmpitm, idI_BAIT)!=0); | |
| 20363 | 4 | temp_zinit.set_item(iHammer, get_bit(&tmpitm, idI_HAMMER)!=0); | |
| 20364 | 4 | } | |
| 20365 | |||
| 20366 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_getc(&tempbyte,f)) |
| 20367 | ✗ | return qe_invalid; | |
| 20368 | 280 | temp_zinit.mcounter[crLIFE] = tempbyte; | |
| 20369 | |||
| 20370 | |||
| 20371 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 217 times.
|
280 | if(s_version < 14) |
| 20372 | { | ||
| 20373 | byte temphp; | ||
| 20374 | |||
| 20375 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(!p_getc(&temphp,f)) |
| 20376 | { | ||
| 20377 | ✗ | return qe_invalid; | |
| 20378 | } | ||
| 20379 | |||
| 20380 | 63 | temp_zinit.counter[crLIFE]=temphp; | |
| 20381 | |||
| 20382 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(!p_getc(&temphp,f)) |
| 20383 | { | ||
| 20384 | ✗ | return qe_invalid; | |
| 20385 | } | ||
| 20386 | |||
| 20387 | 63 | temp_zinit.cont_heart=temphp; | |
| 20388 | 63 | } | |
| 20389 | else | ||
| 20390 | { | ||
| 20391 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_igetw(&temp_zinit.counter[crLIFE],f)) |
| 20392 | { | ||
| 20393 | ✗ | return qe_invalid; | |
| 20394 | } | ||
| 20395 | |||
| 20396 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_igetw(&temp_zinit.cont_heart,f)) |
| 20397 | { | ||
| 20398 | ✗ | return qe_invalid; | |
| 20399 | } | ||
| 20400 | } | ||
| 20401 | |||
| 20402 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_getc(&temp_zinit.hcp,f)) |
| 20403 | { | ||
| 20404 | ✗ | return qe_invalid; | |
| 20405 | } | ||
| 20406 | |||
| 20407 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 217 times.
|
280 | if(s_version >= 14) |
| 20408 | { | ||
| 20409 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_getc(&temp_zinit.hcp_per_hc,f)) |
| 20410 | { | ||
| 20411 | ✗ | return qe_invalid; | |
| 20412 | } | ||
| 20413 | |||
| 20414 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(s_version<16) // July 2007 |
| 20415 | { | ||
| 20416 | ✗ | if(get_qr(qr_BRANGPICKUP+1)) | |
| 20417 | ✗ | temp_zinit.hcp_per_hc = 0xFF; | |
| 20418 | |||
| 20419 | //Dispose of legacy rule | ||
| 20420 | ✗ | set_qr(qr_BRANGPICKUP+1, 0); | |
| 20421 | ✗ | } | |
| 20422 | 217 | } | |
| 20423 | |||
| 20424 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 263 times.
|
280 | if(s_version < 29) |
| 20425 | { | ||
| 20426 |
1/2✓ Branch 0 taken 263 times.
✗ Branch 1 not taken.
|
263 | if(!p_getc(&padding,f)) |
| 20427 | ✗ | return qe_invalid; | |
| 20428 | 263 | temp_zinit.mcounter[crBOMBS] = padding; | |
| 20429 | 263 | } | |
| 20430 | |||
| 20431 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_getc(&temp_zinit.counter[crKEYS],f)) |
| 20432 | { | ||
| 20433 | ✗ | return qe_invalid; | |
| 20434 | } | ||
| 20435 | |||
| 20436 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_igetw(&temp_zinit.counter[crMONEY],f)) |
| 20437 | { | ||
| 20438 | ✗ | return qe_invalid; | |
| 20439 | } | ||
| 20440 | |||
| 20441 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_getc(&tempbyte,f)) |
| 20442 | ✗ | return qe_invalid; | |
| 20443 |
2/2✓ Branch 0 taken 2240 times.
✓ Branch 1 taken 280 times.
|
2520 | for(int q = 0; q < 8; ++q) |
| 20444 |
2/2✓ Branch 0 taken 504 times.
✓ Branch 1 taken 1736 times.
|
2240 | SETFLAG(temp_zinit.litems[q+1], (1 << li_mcguffin), get_bitl(tempbyte, q)); |
| 20445 | |||
| 20446 | 280 | int level_count = 32; | |
| 20447 |
3/6✓ Branch 0 taken 63 times.
✓ Branch 1 taken 217 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 63 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
280 | if(s_version>12 || (Header->zelda_version == 0x211 && Header->build == 18)) |
| 20448 | 217 | level_count = 64; | |
| 20449 | byte tmp_map[64]; | ||
| 20450 | byte tmp_compass[64]; | ||
| 20451 |
2/2✓ Branch 0 taken 15904 times.
✓ Branch 1 taken 280 times.
|
16184 | for(int32_t i=0; i<level_count; i++) |
| 20452 |
1/2✓ Branch 0 taken 15904 times.
✗ Branch 1 not taken.
|
15904 | if(!p_getc(&tmp_map[i],f)) |
| 20453 | ✗ | return qe_invalid; | |
| 20454 |
2/2✓ Branch 0 taken 15904 times.
✓ Branch 1 taken 280 times.
|
16184 | for(int32_t i=0; i<level_count; i++) |
| 20455 |
1/2✓ Branch 0 taken 15904 times.
✗ Branch 1 not taken.
|
15904 | if(!p_getc(&tmp_compass[i],f)) |
| 20456 | ✗ | return qe_invalid; | |
| 20457 |
2/2✓ Branch 0 taken 127232 times.
✓ Branch 1 taken 280 times.
|
127512 | for(int q = 0; q < level_count*8; ++q) |
| 20458 | { | ||
| 20459 |
2/2✓ Branch 0 taken 796 times.
✓ Branch 1 taken 126436 times.
|
127232 | SETFLAG(temp_zinit.litems[q], (1 << li_map), get_bit(tmp_map, q)); |
| 20460 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 127223 times.
|
127232 | SETFLAG(temp_zinit.litems[q], (1 << li_compass), get_bit(tmp_compass, q)); |
| 20461 | 127232 | } | |
| 20462 | |||
| 20463 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 275 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
285 | if((Header->zelda_version > 0x192)|| |
| 20464 | //new only | ||
| 20465 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | ((Header->zelda_version == 0x192)&&(Header->build>173))) |
| 20466 | { | ||
| 20467 | byte tmp_boss_key[64]; | ||
| 20468 |
2/2✓ Branch 0 taken 15776 times.
✓ Branch 1 taken 276 times.
|
16052 | for(int32_t i=0; i<level_count; i++) |
| 20469 | { | ||
| 20470 |
1/2✓ Branch 0 taken 15776 times.
✗ Branch 1 not taken.
|
15776 | if(!p_getc(&tmp_boss_key[i],f)) |
| 20471 | { | ||
| 20472 | ✗ | return qe_invalid; | |
| 20473 | } | ||
| 20474 | 15776 | } | |
| 20475 |
2/2✓ Branch 0 taken 126208 times.
✓ Branch 1 taken 276 times.
|
126484 | for(int q = 0; q < level_count*8; ++q) |
| 20476 | { | ||
| 20477 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 126208 times.
|
126208 | SETFLAG(temp_zinit.litems[q], (1 << li_boss_key), get_bit(tmp_boss_key, q)); |
| 20478 | 126208 | } | |
| 20479 | 276 | } | |
| 20480 | |||
| 20481 | byte tmpmisc[16]; | ||
| 20482 |
2/2✓ Branch 0 taken 4480 times.
✓ Branch 1 taken 280 times.
|
4760 | for(int32_t i=0; i<16; i++) |
| 20483 |
1/2✓ Branch 0 taken 4480 times.
✗ Branch 1 not taken.
|
4480 | if(!p_getc(&tmpmisc[i],f)) |
| 20484 | ✗ | return qe_invalid; | |
| 20485 | 280 | temp_zinit.flags.set(INIT_FL_CONTPERCENT,get_bit(tmpmisc,0)); | |
| 20486 | 280 | temp_zinit.magicdrainrate = get_bit(tmpmisc,1) ? 1 : 2; //Double Magic flag | |
| 20487 | 280 | temp_zinit.flags.set(INIT_FL_CANSLASH,get_bit(tmpmisc,2)); | |
| 20488 | |||
| 20489 |
4/4✓ Branch 0 taken 217 times.
✓ Branch 1 taken 63 times.
✓ Branch 2 taken 252 times.
✓ Branch 3 taken 63 times.
|
532 | if(s_version < 15) for(int32_t i=0; i<4; i++) |
| 20490 |
1/2✓ Branch 0 taken 252 times.
✗ Branch 1 not taken.
|
252 | if(!p_getc(&sword_hearts[i],f)) |
| 20491 | 63 | return qe_invalid; | |
| 20492 | |||
| 20493 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_getc(&temp_zinit.last_map,f)) |
| 20494 | { | ||
| 20495 | ✗ | return qe_invalid; | |
| 20496 | } | ||
| 20497 | |||
| 20498 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_getc(&temp_zinit.last_screen,f)) |
| 20499 | { | ||
| 20500 | ✗ | return qe_invalid; | |
| 20501 | } | ||
| 20502 | |||
| 20503 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 217 times.
|
280 | if(s_version < 14) |
| 20504 | { | ||
| 20505 | byte tempmp; | ||
| 20506 | |||
| 20507 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(!p_getc(&tempmp,f)) |
| 20508 | { | ||
| 20509 | ✗ | return qe_invalid; | |
| 20510 | } | ||
| 20511 | |||
| 20512 | 63 | temp_zinit.mcounter[crMAGIC]=tempmp; | |
| 20513 | |||
| 20514 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(!p_getc(&tempmp,f)) |
| 20515 | { | ||
| 20516 | ✗ | return qe_invalid; | |
| 20517 | } | ||
| 20518 | |||
| 20519 | 63 | temp_zinit.counter[crMAGIC]=tempmp; | |
| 20520 | 63 | } | |
| 20521 | else | ||
| 20522 | { | ||
| 20523 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_igetw(&temp_zinit.mcounter[crMAGIC],f)) |
| 20524 | { | ||
| 20525 | ✗ | return qe_invalid; | |
| 20526 | } | ||
| 20527 | |||
| 20528 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_igetw(&temp_zinit.counter[crMAGIC],f)) |
| 20529 | { | ||
| 20530 | ✗ | return qe_invalid; | |
| 20531 | } | ||
| 20532 | } | ||
| 20533 | |||
| 20534 | |||
| 20535 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 217 times.
|
280 | if(s_version < 15) |
| 20536 | { | ||
| 20537 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63 times.
|
63 | if(s_version < 12) |
| 20538 | { | ||
| 20539 | 63 | temp_zinit.mcounter[crMAGIC]*=32; | |
| 20540 | 63 | temp_zinit.counter[crMAGIC]*=32; | |
| 20541 | 63 | } | |
| 20542 | |||
| 20543 |
2/2✓ Branch 0 taken 252 times.
✓ Branch 1 taken 63 times.
|
315 | for(int32_t i=0; i<4; i++) |
| 20544 | { | ||
| 20545 |
1/2✓ Branch 0 taken 252 times.
✗ Branch 1 not taken.
|
252 | if(!p_getc(&beam_hearts[i],f)) |
| 20546 | { | ||
| 20547 | ✗ | return qe_invalid; | |
| 20548 | } | ||
| 20549 | 252 | } | |
| 20550 | |||
| 20551 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(!p_getc(&beam_percent,f)) |
| 20552 | { | ||
| 20553 | ✗ | return qe_invalid; | |
| 20554 | } | ||
| 20555 | 63 | } | |
| 20556 | else | ||
| 20557 | { | ||
| 20558 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_getc(&temp_zinit.bomb_ratio,f)) |
| 20559 | ✗ | return qe_invalid; | |
| 20560 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(temp_zinit.bomb_ratio < 1) |
| 20561 | ✗ | temp_zinit.bomb_ratio = 1; | |
| 20562 | 217 | else bomb_ratio = temp_zinit.bomb_ratio; //jank | |
| 20563 | } | ||
| 20564 | |||
| 20565 |
2/2✓ Branch 0 taken 217 times.
✓ Branch 1 taken 63 times.
|
280 | if(s_version < 15) |
| 20566 | { | ||
| 20567 | byte tempbp; | ||
| 20568 | |||
| 20569 |
2/2✓ Branch 0 taken 252 times.
✓ Branch 1 taken 63 times.
|
315 | for(int32_t i=0; i<4; i++) |
| 20570 | { | ||
| 20571 |
2/4✓ Branch 0 taken 252 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 252 times.
✗ Branch 3 not taken.
|
252 | if(!(s_version < 14 ? p_getc(&tempbp,f) : p_igetw(&tempbp,f))) |
| 20572 | { | ||
| 20573 | ✗ | return qe_invalid; | |
| 20574 | } | ||
| 20575 | |||
| 20576 | 252 | beam_power[i]=tempbp; | |
| 20577 | 252 | } | |
| 20578 | |||
| 20579 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(!p_getc(&hookshot_links,f)) |
| 20580 | { | ||
| 20581 | ✗ | return qe_invalid; | |
| 20582 | } | ||
| 20583 | |||
| 20584 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(s_version>6) |
| 20585 | { | ||
| 20586 | ✗ | if(!p_getc(&hookshot_length,f)) | |
| 20587 | { | ||
| 20588 | ✗ | return qe_invalid; | |
| 20589 | } | ||
| 20590 | |||
| 20591 | ✗ | if(!p_getc(&longshot_links,f)) | |
| 20592 | { | ||
| 20593 | ✗ | return qe_invalid; | |
| 20594 | } | ||
| 20595 | |||
| 20596 | ✗ | if(!p_getc(&longshot_length,f)) | |
| 20597 | { | ||
| 20598 | ✗ | return qe_invalid; | |
| 20599 | } | ||
| 20600 | ✗ | } | |
| 20601 | 63 | } | |
| 20602 | |||
| 20603 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_getc(&temp_zinit.msg_more_x,f)) |
| 20604 | { | ||
| 20605 | ✗ | return qe_invalid; | |
| 20606 | } | ||
| 20607 | |||
| 20608 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_getc(&temp_zinit.msg_more_y,f)) |
| 20609 | { | ||
| 20610 | ✗ | return qe_invalid; | |
| 20611 | } | ||
| 20612 | |||
| 20613 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_getc(&subscr_mode,f)) |
| 20614 | ✗ | return qe_invalid; | |
| 20615 | |||
| 20616 | //old only | ||
| 20617 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 275 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
280 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 20618 | { | ||
| 20619 | byte tmp_boss_key[32]; | ||
| 20620 |
2/2✓ Branch 0 taken 128 times.
✓ Branch 1 taken 4 times.
|
132 | for(int32_t i=0; i<32; i++) |
| 20621 | { | ||
| 20622 |
1/2✓ Branch 0 taken 128 times.
✗ Branch 1 not taken.
|
128 | if(!p_getc(&tmp_boss_key[i],f)) |
| 20623 | { | ||
| 20624 | ✗ | return qe_invalid; | |
| 20625 | } | ||
| 20626 | 128 | } | |
| 20627 |
2/2✓ Branch 0 taken 1024 times.
✓ Branch 1 taken 4 times.
|
1028 | for(int q = 0; q < 32*8; ++q) |
| 20628 | { | ||
| 20629 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1024 times.
|
1024 | SETFLAG(temp_zinit.litems[q], (1 << li_boss_key), get_bit(tmp_boss_key, q)); |
| 20630 | 1024 | } | |
| 20631 | 4 | } | |
| 20632 | |||
| 20633 |
5/6✓ Branch 0 taken 5 times.
✓ Branch 1 taken 275 times.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 4 times.
|
280 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>173))) //new only |
| 20634 | { | ||
| 20635 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 217 times.
|
276 | if(s_version <= 10) |
| 20636 | { | ||
| 20637 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_getc(&tempbyte,f)) |
| 20638 | { | ||
| 20639 | ✗ | return qe_invalid; | |
| 20640 | } | ||
| 20641 | |||
| 20642 | 59 | temp_zinit.start_dmap = (word)tempbyte; | |
| 20643 | 59 | } | |
| 20644 | else | ||
| 20645 | { | ||
| 20646 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_igetw(&temp_zinit.start_dmap,f)) |
| 20647 | { | ||
| 20648 | ✗ | return qe_invalid; | |
| 20649 | } | ||
| 20650 | } | ||
| 20651 | |||
| 20652 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&temp_zinit.heroAnimationStyle,f)) |
| 20653 | { | ||
| 20654 | ✗ | return qe_invalid; | |
| 20655 | } | ||
| 20656 | 276 | } | |
| 20657 | |||
| 20658 |
4/4✓ Branch 0 taken 217 times.
✓ Branch 1 taken 63 times.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 200 times.
|
280 | if(s_version>1 && s_version < 29) |
| 20659 | { | ||
| 20660 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(!p_getc(&padding,f)) |
| 20661 | ✗ | return qe_invalid; | |
| 20662 | 200 | temp_zinit.counter[crARROWS] = padding; | |
| 20663 | |||
| 20664 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(!p_getc(&padding,f)) |
| 20665 | ✗ | return qe_invalid; | |
| 20666 | 200 | temp_zinit.mcounter[crARROWS] = padding; | |
| 20667 | 200 | } | |
| 20668 | |||
| 20669 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 217 times.
|
280 | if(s_version>2) |
| 20670 | { | ||
| 20671 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 217 times.
|
217 | if(s_version <= 10) |
| 20672 | { | ||
| 20673 | ✗ | for(int32_t i=0; i<OLDMAXLEVELS; i++) | |
| 20674 | { | ||
| 20675 | ✗ | if(!p_getc(&(temp_zinit.level_keys[i]),f)) | |
| 20676 | { | ||
| 20677 | ✗ | return qe_invalid; | |
| 20678 | } | ||
| 20679 | ✗ | } | |
| 20680 | ✗ | } | |
| 20681 | else | ||
| 20682 | { | ||
| 20683 |
2/2✓ Branch 0 taken 111104 times.
✓ Branch 1 taken 217 times.
|
111321 | for(int32_t i=0; i<MAXLEVELS; i++) |
| 20684 | { | ||
| 20685 |
1/2✓ Branch 0 taken 111104 times.
✗ Branch 1 not taken.
|
111104 | if(!p_getc(&(temp_zinit.level_keys[i]),f)) |
| 20686 | { | ||
| 20687 | ✗ | return qe_invalid; | |
| 20688 | } | ||
| 20689 | 111104 | } | |
| 20690 | } | ||
| 20691 | 217 | } | |
| 20692 | |||
| 20693 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 217 times.
|
280 | if(s_version>3) |
| 20694 | { | ||
| 20695 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_igetw(&temp_zinit.ss_grid_x,f)) |
| 20696 | { | ||
| 20697 | ✗ | return qe_invalid; | |
| 20698 | } | ||
| 20699 | |||
| 20700 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_igetw(&temp_zinit.ss_grid_y,f)) |
| 20701 | { | ||
| 20702 | ✗ | return qe_invalid; | |
| 20703 | } | ||
| 20704 | |||
| 20705 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_igetw(&temp_zinit.ss_grid_xofs,f)) |
| 20706 | { | ||
| 20707 | ✗ | return qe_invalid; | |
| 20708 | } | ||
| 20709 | |||
| 20710 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_igetw(&temp_zinit.ss_grid_yofs,f)) |
| 20711 | { | ||
| 20712 | ✗ | return qe_invalid; | |
| 20713 | } | ||
| 20714 | |||
| 20715 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_igetw(&temp_zinit.ss_grid_color,f)) |
| 20716 | { | ||
| 20717 | ✗ | return qe_invalid; | |
| 20718 | } | ||
| 20719 | |||
| 20720 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_igetw(&temp_zinit.ss_bbox_1_color,f)) |
| 20721 | { | ||
| 20722 | ✗ | return qe_invalid; | |
| 20723 | } | ||
| 20724 | |||
| 20725 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_igetw(&temp_zinit.ss_bbox_2_color,f)) |
| 20726 | { | ||
| 20727 | ✗ | return qe_invalid; | |
| 20728 | } | ||
| 20729 | |||
| 20730 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_igetw(&temp_zinit.ss_flags,f)) |
| 20731 | { | ||
| 20732 | ✗ | return qe_invalid; | |
| 20733 | } | ||
| 20734 | |||
| 20735 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 217 times.
|
217 | temp_zinit.ss_grid_x=zc_max(temp_zinit.ss_grid_x,1); |
| 20736 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 217 times.
|
217 | temp_zinit.ss_grid_y=zc_max(temp_zinit.ss_grid_y,1); |
| 20737 | 217 | } | |
| 20738 | |||
| 20739 |
3/4✓ Branch 0 taken 217 times.
✓ Branch 1 taken 63 times.
✓ Branch 2 taken 217 times.
✗ Branch 3 not taken.
|
280 | if(s_version>4 && s_version<15) |
| 20740 | { | ||
| 20741 | ✗ | if(!p_getc(&moving_fairy_hearts,f)) | |
| 20742 | { | ||
| 20743 | ✗ | return qe_invalid; | |
| 20744 | } | ||
| 20745 | |||
| 20746 | ✗ | if(!p_getc(&moving_fairy_heart_percent,f)) | |
| 20747 | { | ||
| 20748 | ✗ | return qe_invalid; | |
| 20749 | } | ||
| 20750 | ✗ | } | |
| 20751 | |||
| 20752 |
3/4✓ Branch 0 taken 217 times.
✓ Branch 1 taken 63 times.
✓ Branch 2 taken 217 times.
✗ Branch 3 not taken.
|
280 | if(s_version>5 && s_version < 10) |
| 20753 | { | ||
| 20754 | ✗ | if(!p_getc(&temp,f)) | |
| 20755 | { | ||
| 20756 | ✗ | return qe_invalid; | |
| 20757 | } | ||
| 20758 | |||
| 20759 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_quiver, temp); | |
| 20760 | ✗ | } | |
| 20761 | |||
| 20762 |
3/4✓ Branch 0 taken 217 times.
✓ Branch 1 taken 63 times.
✓ Branch 2 taken 217 times.
✗ Branch 3 not taken.
|
280 | if(s_version>6 && s_version<15) |
| 20763 | { | ||
| 20764 | ✗ | if(!p_getc(&stationary_fairy_hearts,f)) | |
| 20765 | { | ||
| 20766 | ✗ | return qe_invalid; | |
| 20767 | } | ||
| 20768 | |||
| 20769 | ✗ | if(!p_getc(&stationary_fairy_heart_percent,f)) | |
| 20770 | { | ||
| 20771 | ✗ | return qe_invalid; | |
| 20772 | } | ||
| 20773 | |||
| 20774 | ✗ | if(!p_getc(&moving_fairy_magic,f)) | |
| 20775 | { | ||
| 20776 | ✗ | return qe_invalid; | |
| 20777 | } | ||
| 20778 | |||
| 20779 | ✗ | if(!p_getc(&moving_fairy_magic_percent,f)) | |
| 20780 | { | ||
| 20781 | ✗ | return qe_invalid; | |
| 20782 | } | ||
| 20783 | |||
| 20784 | ✗ | if(!p_getc(&stationary_fairy_magic,f)) | |
| 20785 | { | ||
| 20786 | ✗ | return qe_invalid; | |
| 20787 | } | ||
| 20788 | |||
| 20789 | ✗ | if(!p_getc(&stationary_fairy_magic_percent,f)) | |
| 20790 | { | ||
| 20791 | ✗ | return qe_invalid; | |
| 20792 | } | ||
| 20793 | |||
| 20794 | ✗ | if(!p_getc(&blue_potion_hearts,f)) | |
| 20795 | { | ||
| 20796 | ✗ | return qe_invalid; | |
| 20797 | } | ||
| 20798 | |||
| 20799 | ✗ | if(!p_getc(&blue_potion_heart_percent,f)) | |
| 20800 | { | ||
| 20801 | ✗ | return qe_invalid; | |
| 20802 | } | ||
| 20803 | |||
| 20804 | ✗ | if(!p_getc(&red_potion_hearts,f)) | |
| 20805 | { | ||
| 20806 | ✗ | return qe_invalid; | |
| 20807 | } | ||
| 20808 | |||
| 20809 | ✗ | if(!p_getc(&red_potion_heart_percent,f)) | |
| 20810 | { | ||
| 20811 | ✗ | return qe_invalid; | |
| 20812 | } | ||
| 20813 | |||
| 20814 | ✗ | if(!p_getc(&blue_potion_magic,f)) | |
| 20815 | { | ||
| 20816 | ✗ | return qe_invalid; | |
| 20817 | } | ||
| 20818 | |||
| 20819 | ✗ | if(!p_getc(&blue_potion_magic_percent,f)) | |
| 20820 | { | ||
| 20821 | ✗ | return qe_invalid; | |
| 20822 | } | ||
| 20823 | |||
| 20824 | ✗ | if(!p_getc(&red_potion_magic,f)) | |
| 20825 | { | ||
| 20826 | ✗ | return qe_invalid; | |
| 20827 | } | ||
| 20828 | |||
| 20829 | ✗ | if(!p_getc(&red_potion_magic_percent,f)) | |
| 20830 | { | ||
| 20831 | ✗ | return qe_invalid; | |
| 20832 | } | ||
| 20833 | ✗ | } | |
| 20834 | |||
| 20835 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 217 times.
|
280 | if(s_version>6) |
| 20836 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_getc(&padding,f)) |
| 20837 | ✗ | return qe_invalid; | |
| 20838 | |||
| 20839 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 217 times.
|
280 | if(s_version>7) |
| 20840 | { | ||
| 20841 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_getc(&padding,f)) |
| 20842 | { | ||
| 20843 | ✗ | return qe_invalid; | |
| 20844 | } | ||
| 20845 | 217 | } | |
| 20846 | |||
| 20847 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 217 times.
|
280 | if(s_version>8) |
| 20848 | { | ||
| 20849 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_igetw(&temp_zinit.mcounter[crMONEY],f)) |
| 20850 | { | ||
| 20851 | ✗ | return qe_invalid; | |
| 20852 | } | ||
| 20853 | |||
| 20854 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_igetw(&temp_zinit.mcounter[crKEYS],f)) |
| 20855 | { | ||
| 20856 | ✗ | return qe_invalid; | |
| 20857 | } | ||
| 20858 | 217 | } | |
| 20859 | |||
| 20860 |
2/2✓ Branch 0 taken 217 times.
✓ Branch 1 taken 63 times.
|
280 | if(s_version>16) |
| 20861 | { | ||
| 20862 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_getc(&tempbyte,f)) |
| 20863 | { | ||
| 20864 | ✗ | return qe_invalid; | |
| 20865 | } | ||
| 20866 | 217 | temp_zinit.gravity = tempbyte*100; | |
| 20867 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_igetw(&temp_zinit.terminalv,f)) |
| 20868 | { | ||
| 20869 | ✗ | return qe_invalid; | |
| 20870 | } | ||
| 20871 | |||
| 20872 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_getc(&temp_zinit.msg_speed,f)) |
| 20873 | { | ||
| 20874 | ✗ | return qe_invalid; | |
| 20875 | } | ||
| 20876 | |||
| 20877 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_getc(&padding,f)) |
| 20878 | { | ||
| 20879 | ✗ | return qe_invalid; | |
| 20880 | } | ||
| 20881 | |||
| 20882 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_getc(&temp_zinit.jump_hero_layer_threshold,f)) |
| 20883 | { | ||
| 20884 | ✗ | return qe_invalid; | |
| 20885 | } | ||
| 20886 | 217 | } | |
| 20887 |
2/2✓ Branch 0 taken 52 times.
✓ Branch 1 taken 11 times.
|
63 | else if (replay_version_check(0, 13)) |
| 20888 | 11 | temp_zinit.msg_speed = 0; | |
| 20889 | |||
| 20890 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 217 times.
|
280 | if(s_version>17) |
| 20891 | { | ||
| 20892 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if(!p_getc(&temp_zinit.msg_more_is_offset,f)) |
| 20893 | { | ||
| 20894 | ✗ | return qe_invalid; | |
| 20895 | } | ||
| 20896 | 217 | } | |
| 20897 | |||
| 20898 | //expaned init data for larger values in 2.55 | ||
| 20899 |
2/2✓ Branch 0 taken 263 times.
✓ Branch 1 taken 17 times.
|
280 | if ( s_version >= 19 ) //expand init data bombs, sbombs, and arrows to 0xFFFF |
| 20900 | { | ||
| 20901 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.counter[crBOMBS],f)) |
| 20902 | { | ||
| 20903 | ✗ | return qe_invalid; | |
| 20904 | } | ||
| 20905 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.counter[crSBOMBS],f)) |
| 20906 | { | ||
| 20907 | ✗ | return qe_invalid; | |
| 20908 | } | ||
| 20909 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.mcounter[crBOMBS],f)) |
| 20910 | { | ||
| 20911 | ✗ | return qe_invalid; | |
| 20912 | } | ||
| 20913 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.mcounter[crSBOMBS],f)) |
| 20914 | { | ||
| 20915 | ✗ | return qe_invalid; | |
| 20916 | } | ||
| 20917 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.counter[crARROWS],f)) |
| 20918 | { | ||
| 20919 | ✗ | return qe_invalid; | |
| 20920 | } | ||
| 20921 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.mcounter[crARROWS],f)) |
| 20922 | { | ||
| 20923 | ✗ | return qe_invalid; | |
| 20924 | } | ||
| 20925 | |||
| 20926 | 17 | } | |
| 20927 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 263 times.
|
280 | if ( s_version >= 20 ) |
| 20928 | { | ||
| 20929 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.heroStep,f)) |
| 20930 | { | ||
| 20931 | ✗ | return qe_invalid; | |
| 20932 | } | ||
| 20933 | 17 | } | |
| 20934 | else | ||
| 20935 | { | ||
| 20936 | 263 | temp_zinit.heroStep = 150; //1.5 pixels per frame | |
| 20937 | } | ||
| 20938 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 263 times.
|
280 | if ( s_version >= 21 ) |
| 20939 | { | ||
| 20940 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.subscrSpeed,f)) |
| 20941 | { | ||
| 20942 | ✗ | return qe_invalid; | |
| 20943 | } | ||
| 20944 | 17 | } | |
| 20945 | else | ||
| 20946 | { | ||
| 20947 | 263 | temp_zinit.subscrSpeed = 1; //3 pixels per frame | |
| 20948 | } | ||
| 20949 | //old only | ||
| 20950 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 275 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
280 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 20951 | { | ||
| 20952 | byte items2; | ||
| 20953 | |||
| 20954 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if(!p_getc(&items2,f)) |
| 20955 | { | ||
| 20956 | ✗ | return qe_invalid; | |
| 20957 | } | ||
| 20958 | |||
| 20959 | 4 | temp_zinit.set_item(iDivineFire, get_bit(&items2, idI_DFIRE)!=0); | |
| 20960 | 4 | temp_zinit.set_item(iDivineEscape, get_bit(&items2, idI_FWIND)!=0); | |
| 20961 | 4 | temp_zinit.set_item(iDivineProtection, get_bit(&items2, idI_NLOVE)!=0); | |
| 20962 | 4 | } | |
| 20963 | |||
| 20964 |
2/2✓ Branch 0 taken 275 times.
✓ Branch 1 taken 5 times.
|
280 | if(Header->zelda_version < 0x193) |
| 20965 | { | ||
| 20966 |
2/2✓ Branch 0 taken 480 times.
✓ Branch 1 taken 5 times.
|
485 | for(int32_t q=0; q<96; q++) |
| 20967 | { | ||
| 20968 |
1/2✓ Branch 0 taken 480 times.
✗ Branch 1 not taken.
|
480 | if(!p_getc(&padding,f)) |
| 20969 | { | ||
| 20970 | ✗ | return qe_invalid; | |
| 20971 | } | ||
| 20972 | 480 | } | |
| 20973 | |||
| 20974 | //new only | ||
| 20975 |
3/4✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 1 times.
|
5 | if((Header->zelda_version == 0x192)&&(Header->build>173)) |
| 20976 | { | ||
| 20977 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(!p_getc(&padding,f)) |
| 20978 | { | ||
| 20979 | ✗ | return qe_invalid; | |
| 20980 | } | ||
| 20981 | |||
| 20982 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(!p_getc(&padding,f)) |
| 20983 | { | ||
| 20984 | ✗ | return qe_invalid; | |
| 20985 | } | ||
| 20986 | 1 | } | |
| 20987 | 5 | } | |
| 20988 | 280 | } | |
| 20989 | |||
| 20990 |
3/6✓ Branch 0 taken 217 times.
✓ Branch 1 taken 81 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 217 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
298 | if((Header->zelda_version < 0x211)||((Header->zelda_version == 0x211)&&(Header->build<15))) |
| 20991 | { | ||
| 20992 | //temp_zinit.shield=i_smallshield; | ||
| 20993 | 81 | int32_t sshieldid = getItemID(itemsbuf, itype_shield, i_smallshield); | |
| 20994 | |||
| 20995 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | if(sshieldid != -1) |
| 20996 | 81 | temp_zinit.set_item(sshieldid, true); | |
| 20997 | 81 | } | |
| 20998 | |||
| 20999 |
5/6✓ Branch 0 taken 280 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 275 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
298 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<27))) |
| 21000 | { | ||
| 21001 | 18 | temp_zinit.mcounter[crLIFE]=3; | |
| 21002 | 18 | temp_zinit.counter[crLIFE]=3; | |
| 21003 | 18 | temp_zinit.cont_heart=3; | |
| 21004 | 18 | temp_zinit.mcounter[crBOMBS]=8; | |
| 21005 | 18 | } | |
| 21006 | |||
| 21007 |
5/6✓ Branch 0 taken 280 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 275 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
298 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<50))) |
| 21008 | { | ||
| 21009 | 18 | sword_hearts[0]=0; | |
| 21010 | 18 | sword_hearts[1]=5; | |
| 21011 | 18 | sword_hearts[2]=12; | |
| 21012 | 18 | sword_hearts[3]=21; | |
| 21013 | 18 | } | |
| 21014 | |||
| 21015 |
5/6✓ Branch 0 taken 280 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 275 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
298 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<51))) |
| 21016 | { | ||
| 21017 | 18 | temp_zinit.last_map=0; | |
| 21018 | 18 | temp_zinit.last_screen=0; | |
| 21019 | 18 | } | |
| 21020 | |||
| 21021 |
5/6✓ Branch 0 taken 280 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 275 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
298 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<68))) |
| 21022 | { | ||
| 21023 | 18 | temp_zinit.mcounter[crMAGIC]=0; | |
| 21024 | 18 | temp_zinit.counter[crMAGIC]=0; | |
| 21025 | 18 | temp_zinit.magicdrainrate = 2; | |
| 21026 | 18 | } | |
| 21027 | |||
| 21028 |
5/6✓ Branch 0 taken 280 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 275 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
298 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<129))) |
| 21029 | { | ||
| 21030 | |||
| 21031 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 18 times.
|
90 | for(int32_t x=0; x<4; x++) |
| 21032 | { | ||
| 21033 | 72 | beam_hearts[x]=100; | |
| 21034 | 72 | } | |
| 21035 | |||
| 21036 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 18 times.
|
90 | for(int32_t i=0; i<idBP_MAX; i++) |
| 21037 | { | ||
| 21038 | 72 | set_bit(&beam_percent,i,!get_qr(qr_LENSHINTS+i)); | |
| 21039 | 72 | set_qr(qr_LENSHINTS+i,0); | |
| 21040 | 72 | } | |
| 21041 | |||
| 21042 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 18 times.
|
90 | for(int32_t x=0; x<4; x++) |
| 21043 | { | ||
| 21044 | 72 | beam_power[x]=get_qr(qr_HIDECARRIEDITEMS)?50:100; | |
| 21045 | 72 | } | |
| 21046 | |||
| 21047 | 18 | set_qr(qr_HIDECARRIEDITEMS,0); | |
| 21048 | 18 | hookshot_links=100; | |
| 21049 | 18 | temp_zinit.msg_more_x=224; | |
| 21050 | 18 | temp_zinit.msg_more_y=64; | |
| 21051 | 18 | } | |
| 21052 | |||
| 21053 | // Okay, let's put these legacy values into itemsbuf. | ||
| 21054 |
2/2✓ Branch 0 taken 217 times.
✓ Branch 1 taken 81 times.
|
298 | if(s_version < 15) |
| 21055 |
2/2✓ Branch 0 taken 20736 times.
✓ Branch 1 taken 81 times.
|
20817 | for(int32_t i=0; i<MAXITEMS; i++) |
| 21056 | { | ||
| 21057 |
11/11✓ Branch 0 taken 81 times.
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 81 times.
✓ Branch 3 taken 81 times.
✓ Branch 4 taken 81 times.
✓ Branch 5 taken 81 times.
✓ Branch 6 taken 81 times.
✓ Branch 7 taken 81 times.
✓ Branch 8 taken 19926 times.
✓ Branch 9 taken 81 times.
✓ Branch 10 taken 81 times.
|
20736 | switch(i) |
| 21058 | { | ||
| 21059 | case iFairyStill: | ||
| 21060 | 81 | itemsbuf[i].misc1 = stationary_fairy_hearts; | |
| 21061 | 81 | itemsbuf[i].misc2 = stationary_fairy_magic; | |
| 21062 | 81 | itemsbuf[i].misc3 = 0; | |
| 21063 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | if (stationary_fairy_heart_percent) itemsbuf[i].flags |= item_flag1; |
| 21064 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | if (stationary_fairy_magic_percent) itemsbuf[i].flags |= item_flag2; |
| 21065 | 81 | break; | |
| 21066 | |||
| 21067 | case iFairyMoving: | ||
| 21068 | 81 | itemsbuf[i].misc1 = moving_fairy_hearts; | |
| 21069 | 81 | itemsbuf[i].misc2 = moving_fairy_magic; | |
| 21070 | 81 | itemsbuf[i].misc3 = 50; | |
| 21071 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | if (moving_fairy_heart_percent) itemsbuf[i].flags |= item_flag1; |
| 21072 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | if (moving_fairy_magic_percent) itemsbuf[i].flags |= item_flag2; |
| 21073 | 81 | break; | |
| 21074 | |||
| 21075 | case iRPotion: | ||
| 21076 | 81 | itemsbuf[i].misc1 = red_potion_hearts; | |
| 21077 | 81 | itemsbuf[i].misc2 = red_potion_magic; | |
| 21078 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 81 times.
|
81 | if (red_potion_heart_percent) itemsbuf[i].flags |= item_flag1; |
| 21079 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 81 times.
|
81 | if (red_potion_magic_percent) itemsbuf[i].flags |= item_flag2; |
| 21080 | 81 | break; | |
| 21081 | |||
| 21082 | case iBPotion: | ||
| 21083 | 81 | itemsbuf[i].misc1 = blue_potion_hearts; | |
| 21084 | 81 | itemsbuf[i].misc2 = blue_potion_magic; | |
| 21085 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 81 times.
|
81 | if (blue_potion_heart_percent) itemsbuf[i].flags |= item_flag1; |
| 21086 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 81 times.
|
81 | if (blue_potion_magic_percent) itemsbuf[i].flags |= item_flag2; |
| 21087 | 81 | break; | |
| 21088 | |||
| 21089 | case iSword: | ||
| 21090 | 81 | itemsbuf[i].pickup_hearts = sword_hearts[0]; | |
| 21091 | 81 | itemsbuf[i].misc1 = beam_hearts[0]; | |
| 21092 | 81 | itemsbuf[i].misc2 = beam_power[0]; | |
| 21093 | // It seems that item_flag1 was already added by reset_itembuf()... | ||
| 21094 | 81 | itemsbuf[i].flags &= (!get_bit(&beam_percent,0)) ? ~item_flag1 : ~item_none; | |
| 21095 | 81 | break; | |
| 21096 | |||
| 21097 | case iWSword: | ||
| 21098 | 81 | itemsbuf[i].pickup_hearts = sword_hearts[1]; | |
| 21099 | 81 | itemsbuf[i].misc1 = beam_hearts[1]; | |
| 21100 | 81 | itemsbuf[i].misc2 = beam_power[1]; | |
| 21101 | 81 | itemsbuf[i].flags &= (!get_bit(&beam_percent,1)) ? ~item_flag1 : ~item_none; | |
| 21102 | 81 | break; | |
| 21103 | |||
| 21104 | case iMSword: | ||
| 21105 | 81 | itemsbuf[i].pickup_hearts = sword_hearts[2]; | |
| 21106 | 81 | itemsbuf[i].misc1 = beam_hearts[2]; | |
| 21107 | 81 | itemsbuf[i].misc2 = beam_power[2]; | |
| 21108 | 81 | itemsbuf[i].flags &= (!get_bit(&beam_percent,2)) ? ~item_flag1 : ~item_none; | |
| 21109 | 81 | break; | |
| 21110 | |||
| 21111 | case iXSword: | ||
| 21112 | 81 | itemsbuf[i].pickup_hearts = sword_hearts[3]; | |
| 21113 | 81 | itemsbuf[i].misc1 = beam_hearts[3]; | |
| 21114 | 81 | itemsbuf[i].misc2 = beam_power[3]; | |
| 21115 | 81 | itemsbuf[i].flags &= (!get_bit(&beam_percent,3)) ? ~item_flag1 : ~item_none; | |
| 21116 | 81 | break; | |
| 21117 | |||
| 21118 | case iHookshot: | ||
| 21119 | 81 | itemsbuf[i].misc1 = hookshot_length; | |
| 21120 | 81 | itemsbuf[i].misc2 = hookshot_links; | |
| 21121 | 81 | break; | |
| 21122 | |||
| 21123 | case iLongshot: | ||
| 21124 | 81 | itemsbuf[i].misc1 = longshot_length; | |
| 21125 | 81 | itemsbuf[i].misc2 = longshot_links; | |
| 21126 | 81 | break; | |
| 21127 | } | ||
| 21128 | 20817 | } | |
| 21129 | |||
| 21130 |
6/6✓ Branch 0 taken 280 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 275 times.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 1 times.
|
298 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<168))) |
| 21131 | { | ||
| 21132 | //was new subscreen rule | ||
| 21133 | 22 | subscr_mode=get_qr(qr_FREEFORM)?1:0; | |
| 21134 | 22 | set_qr(qr_FREEFORM,0); | |
| 21135 | 22 | } | |
| 21136 | |||
| 21137 |
5/6✓ Branch 0 taken 280 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 275 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
298 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<185))) |
| 21138 | { | ||
| 21139 | 23 | temp_zinit.start_dmap=0; | |
| 21140 | 23 | } | |
| 21141 | |||
| 21142 |
5/6✓ Branch 0 taken 280 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 275 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
298 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<186))) |
| 21143 | { | ||
| 21144 | 23 | temp_zinit.heroAnimationStyle=get_qr(qr_BSZELDA)?1:0; | |
| 21145 | 23 | } | |
| 21146 | |||
| 21147 |
3/4✓ Branch 0 taken 81 times.
✓ Branch 1 taken 217 times.
✓ Branch 2 taken 81 times.
✗ Branch 3 not taken.
|
298 | if(s_version < 16 && get_bit(deprecated_rules, qr_COOLSCROLL+1)) |
| 21148 | { | ||
| 21149 | //addOldStyleFamily(&temp_zinit, itemsbuf, itype_wallet, 4); //is this needed? | ||
| 21150 | ✗ | temp_zinit.mcounter[crMONEY]=999; | |
| 21151 | //temp_zinit.counter[crMONEY]=999; //This rule only gave you an invisible max wallet; it did not give you max rupies. | ||
| 21152 | ✗ | } | |
| 21153 |
2/2✓ Branch 0 taken 292 times.
✓ Branch 1 taken 6 times.
|
298 | if(Header->zelda_version < 0x190) //1.84 bugfix. -Z |
| 21154 | { | ||
| 21155 | //temp_zinit.items[iBombBag] = true; //No, this is 30 max bombs! | ||
| 21156 | 6 | temp_zinit.mcounter[crBOMBS] = 8; | |
| 21157 | 6 | } | |
| 21158 | // al_trace("About to copy over new init data values for quest made in: %x\n", Header->zelda_version); | ||
| 21159 | //time to ensure that we port all new values properly: | ||
| 21160 |
2/2✓ Branch 0 taken 217 times.
✓ Branch 1 taken 81 times.
|
298 | if(Header->zelda_version < 0x250) |
| 21161 | { | ||
| 21162 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | temp_zinit.mcounter[crSBOMBS] = bomb_ratio > 0 ? ( temp_zinit.mcounter[crBOMBS]/temp_zinit.bomb_ratio ) : (temp_zinit.mcounter[crBOMBS]/4); |
| 21163 | 81 | } | |
| 21164 | |||
| 21165 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 281 times.
|
298 | if(s_version > 21) |
| 21166 | { | ||
| 21167 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.hp_per_heart,f)) |
| 21168 | { | ||
| 21169 | ✗ | return qe_invalid; | |
| 21170 | } | ||
| 21171 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.magic_per_block,f)) |
| 21172 | { | ||
| 21173 | ✗ | return qe_invalid; | |
| 21174 | } | ||
| 21175 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.hero_damage_multiplier,f)) |
| 21176 | { | ||
| 21177 | ✗ | return qe_invalid; | |
| 21178 | } | ||
| 21179 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.ene_damage_multiplier,f)) |
| 21180 | { | ||
| 21181 | ✗ | return qe_invalid; | |
| 21182 | } | ||
| 21183 | 17 | } | |
| 21184 | else | ||
| 21185 | { | ||
| 21186 | 281 | temp_zinit.hp_per_heart = 16; //HP_PER_HEART, previously hardcoded | |
| 21187 | 281 | temp_zinit.magic_per_block = 32; //MAGICPERBLOCK, previously hardcoded | |
| 21188 | 281 | temp_zinit.hero_damage_multiplier = 2; //DAMAGE_MULTIPLIER, previously hardcoded | |
| 21189 | 281 | temp_zinit.ene_damage_multiplier = 4; //(HP_PER_HEART/4), previously hardcoded | |
| 21190 | } | ||
| 21191 | |||
| 21192 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 17 times.
|
298 | if(s_version > 22) |
| 21193 | { | ||
| 21194 |
2/2✓ Branch 0 taken 425 times.
✓ Branch 1 taken 17 times.
|
442 | for(int32_t q = crCUSTOM1; q <= crCUSTOM25; ++q) |
| 21195 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 425 times.
|
425 | if(!p_igetw(&temp_zinit.counter[q],f)) |
| 21196 | ✗ | return qe_invalid; | |
| 21197 |
2/2✓ Branch 0 taken 425 times.
✓ Branch 1 taken 17 times.
|
442 | for(int32_t q = crCUSTOM1; q <= crCUSTOM25; ++q) |
| 21198 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 425 times.
|
425 | if(!p_igetw(&temp_zinit.mcounter[q],f)) |
| 21199 | ✗ | return qe_invalid; | |
| 21200 | 17 | } | |
| 21201 | |||
| 21202 | |||
| 21203 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 281 times.
|
298 | if(s_version > 23) |
| 21204 | { | ||
| 21205 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.dither_type,f)) |
| 21206 | { | ||
| 21207 | ✗ | return qe_invalid; | |
| 21208 | } | ||
| 21209 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.dither_arg,f)) |
| 21210 | { | ||
| 21211 | ✗ | return qe_invalid; | |
| 21212 | } | ||
| 21213 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.dither_percent,f)) |
| 21214 | { | ||
| 21215 | ✗ | return qe_invalid; | |
| 21216 | } | ||
| 21217 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.def_lightrad,f)) |
| 21218 | { | ||
| 21219 | ✗ | return qe_invalid; | |
| 21220 | } | ||
| 21221 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.transdark_percent,f)) |
| 21222 | { | ||
| 21223 | ✗ | return qe_invalid; | |
| 21224 | } | ||
| 21225 | 17 | } | |
| 21226 | else | ||
| 21227 | { | ||
| 21228 | 281 | temp_zinit.dither_type = 0; | |
| 21229 | 281 | temp_zinit.dither_arg = 0; | |
| 21230 | 281 | temp_zinit.dither_percent = 20; | |
| 21231 | 281 | temp_zinit.def_lightrad = 24; | |
| 21232 | 281 | temp_zinit.transdark_percent = 0; | |
| 21233 | } | ||
| 21234 | |||
| 21235 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 281 times.
|
298 | if(s_version > 24) |
| 21236 | { | ||
| 21237 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.darkcol,f)) |
| 21238 | { | ||
| 21239 | ✗ | return qe_invalid; | |
| 21240 | } | ||
| 21241 | 17 | } | |
| 21242 | else | ||
| 21243 | { | ||
| 21244 | 281 | temp_zinit.darkcol = BLACK; | |
| 21245 | } | ||
| 21246 | |||
| 21247 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 17 times.
|
298 | if(s_version > 25) |
| 21248 | { | ||
| 21249 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetl(&temp_zinit.gravity,f)) |
| 21250 | { | ||
| 21251 | ✗ | return qe_invalid; | |
| 21252 | } | ||
| 21253 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetl(&temp_zinit.swimgravity,f)) |
| 21254 | { | ||
| 21255 | ✗ | return qe_invalid; | |
| 21256 | } | ||
| 21257 | 17 | } | |
| 21258 | |||
| 21259 | |||
| 21260 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 281 times.
|
298 | if(s_version > 26) |
| 21261 | { | ||
| 21262 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.heroSideswimUpStep,f)) |
| 21263 | { | ||
| 21264 | ✗ | return qe_invalid; | |
| 21265 | } | ||
| 21266 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.heroSideswimSideStep,f)) |
| 21267 | { | ||
| 21268 | ✗ | return qe_invalid; | |
| 21269 | } | ||
| 21270 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.heroSideswimDownStep,f)) |
| 21271 | { | ||
| 21272 | ✗ | return qe_invalid; | |
| 21273 | } | ||
| 21274 | 17 | } | |
| 21275 | else | ||
| 21276 | { | ||
| 21277 | 281 | temp_zinit.heroSideswimUpStep = 150; | |
| 21278 | 281 | temp_zinit.heroSideswimSideStep = 100; | |
| 21279 | 281 | temp_zinit.heroSideswimDownStep = 75; | |
| 21280 | } | ||
| 21281 | |||
| 21282 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 281 times.
|
298 | if(s_version > 27) |
| 21283 | { | ||
| 21284 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetl(&temp_zinit.exitWaterJump,f)) |
| 21285 | { | ||
| 21286 | ✗ | return qe_invalid; | |
| 21287 | } | ||
| 21288 | 17 | } | |
| 21289 | else | ||
| 21290 | { | ||
| 21291 | 281 | temp_zinit.exitWaterJump = 0; | |
| 21292 | } | ||
| 21293 | |||
| 21294 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 281 times.
|
298 | if(s_version > 29) |
| 21295 | { | ||
| 21296 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetl(&temp_zinit.bunny_ltm,f)) |
| 21297 | { | ||
| 21298 | ✗ | return qe_invalid; | |
| 21299 | } | ||
| 21300 | 17 | } | |
| 21301 | else | ||
| 21302 | { | ||
| 21303 | 281 | temp_zinit.bunny_ltm = 0; | |
| 21304 | } | ||
| 21305 | |||
| 21306 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 281 times.
|
298 | if(s_version > 30) |
| 21307 | { | ||
| 21308 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.switchhookstyle,f)) |
| 21309 | { | ||
| 21310 | ✗ | return qe_invalid; | |
| 21311 | } | ||
| 21312 | 17 | } | |
| 21313 | else | ||
| 21314 | { | ||
| 21315 | 281 | temp_zinit.switchhookstyle = 1; | |
| 21316 | } | ||
| 21317 | |||
| 21318 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 17 times.
|
298 | if(s_version > 31) |
| 21319 | { | ||
| 21320 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.magicdrainrate,f)) |
| 21321 | { | ||
| 21322 | ✗ | return qe_invalid; | |
| 21323 | } | ||
| 21324 | 17 | } | |
| 21325 | |||
| 21326 | 298 | temp_zinit.clear_genscript(); | |
| 21327 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 12 times.
|
298 | if(s_version > 32) |
| 21328 | { | ||
| 21329 | 12 | word numgenscript = 0; | |
| 21330 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | if(!p_igetw(&numgenscript,f)) |
| 21331 | ✗ | return qe_invalid; | |
| 21332 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if (numgenscript > NUMSCRIPTSGENERIC) |
| 21333 | ✗ | return qe_invalid; | |
| 21334 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | for(auto q = 1; q < numgenscript; ++q) |
| 21335 | { | ||
| 21336 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 21337 | ✗ | return qe_invalid; | |
| 21338 | ✗ | if(!(tempbyte&2)) | |
| 21339 | ✗ | continue; | |
| 21340 | ✗ | temp_zinit.gen_doscript.set(q, tempbyte&1); | |
| 21341 | ✗ | if(!p_igetw(&temp_zinit.gen_exitState[q],f)) | |
| 21342 | ✗ | return qe_invalid; | |
| 21343 | ✗ | if(!p_igetw(&temp_zinit.gen_reloadState[q],f)) | |
| 21344 | ✗ | return qe_invalid; | |
| 21345 | ✗ | for(auto p = 0; p < 8; ++p) | |
| 21346 | ✗ | if(!p_igetl(&temp_zinit.gen_initd[q][p],f)) | |
| 21347 | ✗ | return qe_invalid; | |
| 21348 | dword sz; | ||
| 21349 | ✗ | if(!p_igetl(&sz,f)) | |
| 21350 | ✗ | return qe_invalid; | |
| 21351 | ✗ | temp_zinit.gen_data[q].resize(sz); | |
| 21352 | ✗ | std::vector<int32_t> dummy; | |
| 21353 | ✗ | if(!p_getlvec(&dummy,f)) | |
| 21354 | ✗ | return qe_invalid; | |
| 21355 | ✗ | temp_zinit.gen_data[q] = dummy; | |
| 21356 | ✗ | if(!p_igetl(&temp_zinit.gen_eventstate[q],f)) | |
| 21357 | ✗ | return qe_invalid; | |
| 21358 | ✗ | } | |
| 21359 | 12 | } | |
| 21360 |
2/2✓ Branch 0 taken 292 times.
✓ Branch 1 taken 6 times.
|
298 | if(s_version > 33) |
| 21361 | { | ||
| 21362 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if(!p_getc(&temp_zinit.hero_swim_mult,f)) |
| 21363 | ✗ | return qe_invalid; | |
| 21364 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if(!p_getc(&temp_zinit.hero_swim_div,f)) |
| 21365 | ✗ | return qe_invalid; | |
| 21366 | 6 | } | |
| 21367 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | if(s_version > 34) |
| 21368 | { | ||
| 21369 | uint32_t num_used_mapscr_data; | ||
| 21370 | ✗ | if(!p_igetl(&num_used_mapscr_data,f)) | |
| 21371 | ✗ | return qe_invalid; | |
| 21372 | ✗ | for(uint32_t q = 0; q < num_used_mapscr_data; ++q) | |
| 21373 | { | ||
| 21374 | uint32_t sz; | ||
| 21375 | ✗ | if(!p_igetl(&sz,f)) | |
| 21376 | ✗ | return qe_invalid; | |
| 21377 | ✗ | temp_zinit.screen_data[q].resize(sz); | |
| 21378 | ✗ | if(sz) | |
| 21379 | { | ||
| 21380 | ✗ | std::vector<int32_t> dummy; | |
| 21381 | ✗ | if(!p_getlvec(&dummy,f)) | |
| 21382 | ✗ | return qe_invalid; | |
| 21383 | ✗ | temp_zinit.screen_data[q] = dummy; | |
| 21384 | ✗ | } | |
| 21385 | ✗ | } | |
| 21386 | ✗ | } | |
| 21387 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | if (s_version > 35) |
| 21388 | ✗ | if(!p_igetzf(&temp_zinit.shove_offset,f)) | |
| 21389 | ✗ | return qe_invalid; | |
| 21390 | |||
| 21391 | 298 | temp_zinit.counter[crLIFE] *= temp_zinit.hp_per_heart; | |
| 21392 | 298 | temp_zinit.mcounter[crLIFE] *= temp_zinit.hp_per_heart; | |
| 21393 |
2/2✓ Branch 0 taken 188 times.
✓ Branch 1 taken 110 times.
|
298 | if(!temp_zinit.flags.get(INIT_FL_CONTPERCENT)) |
| 21394 | 110 | temp_zinit.cont_heart *= temp_zinit.hp_per_heart; | |
| 21395 | |||
| 21396 | 298 | return 0; | |
| 21397 | 298 | } | |
| 21398 | 496 | int32_t readinitdata(PACKFILE *f, zquestheader *Header) | |
| 21399 | { | ||
| 21400 | 496 | zinitdata temp_zinit = {}; | |
| 21401 | |||
| 21402 |
3/4✓ Branch 0 taken 473 times.
✓ Branch 1 taken 23 times.
✓ Branch 2 taken 23 times.
✗ Branch 3 not taken.
|
496 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_initdata); |
| 21403 | |||
| 21404 | int32_t dummy; | ||
| 21405 | 496 | word s_version=0; | |
| 21406 | byte padding; | ||
| 21407 | |||
| 21408 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 23 times.
|
496 | if(Header->zelda_version > 0x192) |
| 21409 | { | ||
| 21410 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 473 times.
✗ Branch 3 not taken.
|
473 | if(!p_igetw(&s_version,f)) |
| 21411 | ✗ | return qe_invalid; | |
| 21412 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | if (s_version > V_INITDATA) |
| 21413 | ✗ | return qe_version; | |
| 21414 | 473 | FFCore.quest_format[vInitData] = s_version; | |
| 21415 | |||
| 21416 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 473 times.
|
473 | if(!read_deprecated_section_cversion(f)) |
| 21417 | ✗ | return qe_invalid; | |
| 21418 | |||
| 21419 | //section size | ||
| 21420 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 473 times.
✗ Branch 3 not taken.
|
473 | if(!p_igetl(&dummy,f)) |
| 21421 | ✗ | return qe_invalid; | |
| 21422 | 473 | } | |
| 21423 | |||
| 21424 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 198 times.
|
496 | if(s_version < 37) |
| 21425 | { | ||
| 21426 |
2/4✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 298 times.
|
298 | if(auto ret = readinitdata_old(f,Header,s_version,temp_zinit)) |
| 21427 | ✗ | return ret; | |
| 21428 | 298 | } | |
| 21429 | else | ||
| 21430 | { | ||
| 21431 | 198 | subscr_mode = ssdtMAX; | |
| 21432 |
2/2✓ Branch 0 taken 6336 times.
✓ Branch 1 taken 198 times.
|
6534 | for(int q = 0; q < MAXITEMS/8; ++q) |
| 21433 |
2/4✓ Branch 0 taken 6336 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6336 times.
|
6336 | if(!p_getc(&temp_zinit.items[q], f)) |
| 21434 | ✗ | return qe_invalid; | |
| 21435 |
2/2✓ Branch 0 taken 169 times.
✓ Branch 1 taken 29 times.
|
198 | if(s_version >= 42) |
| 21436 | { | ||
| 21437 |
2/2✓ Branch 0 taken 86528 times.
✓ Branch 1 taken 169 times.
|
86697 | for(int q = 0; q < MAXLEVELS; ++q) |
| 21438 | { | ||
| 21439 |
2/2✓ Branch 0 taken 8192 times.
✓ Branch 1 taken 78336 times.
|
86528 | if (s_version >= 44) |
| 21440 | { | ||
| 21441 |
2/4✓ Branch 0 taken 78336 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 78336 times.
|
78336 | if(!p_igetw(&temp_zinit.litems[q], f)) |
| 21442 | ✗ | return qe_invalid; | |
| 21443 | 78336 | } | |
| 21444 | else | ||
| 21445 | { | ||
| 21446 |
2/4✓ Branch 0 taken 8192 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8192 times.
|
8192 | if(!p_getc(&padding, f)) |
| 21447 | ✗ | return qe_invalid; | |
| 21448 | 8192 | temp_zinit.litems[q] = word(padding); | |
| 21449 | } | ||
| 21450 | 86528 | } | |
| 21451 | 169 | } | |
| 21452 | else | ||
| 21453 | { | ||
| 21454 | byte tmp_map[MAXLEVELS/8]; | ||
| 21455 | byte tmp_compass[MAXLEVELS/8]; | ||
| 21456 | byte tmp_boss_key[MAXLEVELS/8]; | ||
| 21457 | byte tmp_mcguffin[MAXLEVELS/8]; | ||
| 21458 |
2/2✓ Branch 0 taken 1856 times.
✓ Branch 1 taken 29 times.
|
1885 | for(int q = 0; q < MAXLEVELS/8; ++q) |
| 21459 | { | ||
| 21460 |
2/4✓ Branch 0 taken 1856 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1856 times.
✗ Branch 3 not taken.
|
1856 | if(!p_getc(&tmp_map[q], f)) |
| 21461 | ✗ | return qe_invalid; | |
| 21462 |
2/4✓ Branch 0 taken 1856 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1856 times.
|
1856 | if(!p_getc(&tmp_compass[q], f)) |
| 21463 | ✗ | return qe_invalid; | |
| 21464 |
2/4✓ Branch 0 taken 1856 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1856 times.
|
1856 | if(!p_getc(&tmp_boss_key[q], f)) |
| 21465 | ✗ | return qe_invalid; | |
| 21466 |
2/4✓ Branch 0 taken 1856 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1856 times.
✗ Branch 3 not taken.
|
1856 | if(!p_getc(&tmp_mcguffin[q], f)) |
| 21467 | ✗ | return qe_invalid; | |
| 21468 | 1856 | } | |
| 21469 |
2/2✓ Branch 0 taken 14848 times.
✓ Branch 1 taken 29 times.
|
14877 | for(int q = 0; q < MAXLEVELS; ++q) |
| 21470 | { | ||
| 21471 |
2/4✓ Branch 0 taken 14848 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14848 times.
✗ Branch 3 not taken.
|
14848 | SETFLAG(temp_zinit.litems[q], (1 << li_map), get_bit(tmp_map, q)); |
| 21472 |
3/4✓ Branch 0 taken 14848 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 14828 times.
|
14848 | SETFLAG(temp_zinit.litems[q], (1 << li_compass), get_bit(tmp_compass, q)); |
| 21473 |
2/4✓ Branch 0 taken 14848 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 14848 times.
|
14848 | SETFLAG(temp_zinit.litems[q], (1 << li_boss_key), get_bit(tmp_boss_key, q)); |
| 21474 |
2/4✓ Branch 0 taken 14848 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14848 times.
✗ Branch 3 not taken.
|
14848 | SETFLAG(temp_zinit.litems[q], (1 << li_mcguffin), get_bit(tmp_mcguffin, q)); |
| 21475 | 14848 | } | |
| 21476 | } | ||
| 21477 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getbvec(&temp_zinit.level_keys, f)) |
| 21478 | ✗ | return qe_invalid; | |
| 21479 | byte num_counters; | ||
| 21480 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&num_counters,f)) |
| 21481 | ✗ | return qe_invalid; | |
| 21482 |
2/2✓ Branch 0 taken 21186 times.
✓ Branch 1 taken 198 times.
|
21384 | for(int q = 0; q < num_counters; ++q) |
| 21483 |
2/4✓ Branch 0 taken 21186 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 21186 times.
|
21186 | if(!p_igetw(&temp_zinit.counter[q],f)) |
| 21484 | ✗ | return qe_invalid; | |
| 21485 |
2/2✓ Branch 0 taken 198 times.
✓ Branch 1 taken 21186 times.
|
21384 | for(int q = 0; q < num_counters; ++q) |
| 21486 |
2/4✓ Branch 0 taken 21186 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 21186 times.
|
21186 | if(!p_igetw(&temp_zinit.mcounter[q],f)) |
| 21487 | ✗ | return qe_invalid; | |
| 21488 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.bomb_ratio,f)) |
| 21489 | ✗ | return qe_invalid; | |
| 21490 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.hcp,f)) |
| 21491 | ✗ | return qe_invalid; | |
| 21492 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.hcp_per_hc,f)) |
| 21493 | ✗ | return qe_invalid; | |
| 21494 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 198 times.
|
198 | if(!p_igetw(&temp_zinit.cont_heart,f)) |
| 21495 | ✗ | return qe_invalid; | |
| 21496 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.hp_per_heart,f)) |
| 21497 | ✗ | return qe_invalid; | |
| 21498 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 198 times.
|
198 | if(!p_getc(&temp_zinit.magic_per_block,f)) |
| 21499 | ✗ | return qe_invalid; | |
| 21500 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.hero_damage_multiplier,f)) |
| 21501 | ✗ | return qe_invalid; | |
| 21502 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.ene_damage_multiplier,f)) |
| 21503 | ✗ | return qe_invalid; | |
| 21504 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.dither_type,f)) |
| 21505 | ✗ | return qe_invalid; | |
| 21506 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.dither_arg,f)) |
| 21507 | ✗ | return qe_invalid; | |
| 21508 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 198 times.
|
198 | if(!p_getc(&temp_zinit.dither_percent,f)) |
| 21509 | ✗ | return qe_invalid; | |
| 21510 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.def_lightrad,f)) |
| 21511 | ✗ | return qe_invalid; | |
| 21512 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.transdark_percent,f)) |
| 21513 | ✗ | return qe_invalid; | |
| 21514 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.darkcol,f)) |
| 21515 | ✗ | return qe_invalid; | |
| 21516 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_igetl(&temp_zinit.ss_grid_x,f)) |
| 21517 | ✗ | return qe_invalid; | |
| 21518 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_igetl(&temp_zinit.ss_grid_y,f)) |
| 21519 | ✗ | return qe_invalid; | |
| 21520 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_igetl(&temp_zinit.ss_grid_xofs,f)) |
| 21521 | ✗ | return qe_invalid; | |
| 21522 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_igetl(&temp_zinit.ss_grid_yofs,f)) |
| 21523 | ✗ | return qe_invalid; | |
| 21524 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_igetl(&temp_zinit.ss_grid_color,f)) |
| 21525 | ✗ | return qe_invalid; | |
| 21526 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 198 times.
|
198 | if(!p_igetl(&temp_zinit.ss_bbox_1_color,f)) |
| 21527 | ✗ | return qe_invalid; | |
| 21528 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_igetl(&temp_zinit.ss_bbox_2_color,f)) |
| 21529 | ✗ | return qe_invalid; | |
| 21530 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_igetl(&temp_zinit.ss_flags,f)) |
| 21531 | ✗ | return qe_invalid; | |
| 21532 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getbitstr(&temp_zinit.flags,f)) |
| 21533 | ✗ | return qe_invalid; | |
| 21534 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 198 times.
|
198 | if(!p_getc(&temp_zinit.last_map,f)) |
| 21535 | ✗ | return qe_invalid; | |
| 21536 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.last_screen,f)) |
| 21537 | ✗ | return qe_invalid; | |
| 21538 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.msg_more_x,f)) |
| 21539 | ✗ | return qe_invalid; | |
| 21540 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.msg_more_y,f)) |
| 21541 | ✗ | return qe_invalid; | |
| 21542 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.msg_more_is_offset,f)) |
| 21543 | ✗ | return qe_invalid; | |
| 21544 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.msg_speed,f)) |
| 21545 | ✗ | return qe_invalid; | |
| 21546 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_igetl(&temp_zinit.gravity,f)) |
| 21547 | ✗ | return qe_invalid; | |
| 21548 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_igetl(&temp_zinit.swimgravity,f)) |
| 21549 | ✗ | return qe_invalid; | |
| 21550 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_igetw(&temp_zinit.terminalv,f)) |
| 21551 | ✗ | return qe_invalid; | |
| 21552 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.hero_swim_speed,f)) |
| 21553 | ✗ | return qe_invalid; | |
| 21554 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.hero_swim_mult,f)) |
| 21555 | ✗ | return qe_invalid; | |
| 21556 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.hero_swim_div,f)) |
| 21557 | ✗ | return qe_invalid; | |
| 21558 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_igetw(&temp_zinit.heroSideswimUpStep,f)) |
| 21559 | ✗ | return qe_invalid; | |
| 21560 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_igetw(&temp_zinit.heroSideswimSideStep,f)) |
| 21561 | ✗ | return qe_invalid; | |
| 21562 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_igetw(&temp_zinit.heroSideswimDownStep,f)) |
| 21563 | ✗ | return qe_invalid; | |
| 21564 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_igetl(&temp_zinit.exitWaterJump,f)) |
| 21565 | ✗ | return qe_invalid; | |
| 21566 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_igetw(&temp_zinit.heroStep,f)) |
| 21567 | ✗ | return qe_invalid; | |
| 21568 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.heroAnimationStyle,f)) |
| 21569 | ✗ | return qe_invalid; | |
| 21570 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.jump_hero_layer_threshold,f)) |
| 21571 | ✗ | return qe_invalid; | |
| 21572 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_igetl(&temp_zinit.bunny_ltm,f)) |
| 21573 | ✗ | return qe_invalid; | |
| 21574 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_igetw(&temp_zinit.start_dmap,f)) |
| 21575 | ✗ | return qe_invalid; | |
| 21576 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_igetw(&temp_zinit.subscrSpeed,f)) |
| 21577 | ✗ | return qe_invalid; | |
| 21578 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.switchhookstyle,f)) |
| 21579 | ✗ | return qe_invalid; | |
| 21580 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getc(&temp_zinit.magicdrainrate,f)) |
| 21581 | ✗ | return qe_invalid; | |
| 21582 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_igetzf(&temp_zinit.shove_offset,f)) |
| 21583 | ✗ | return qe_invalid; | |
| 21584 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getbitstr(&temp_zinit.gen_doscript, f)) |
| 21585 | ✗ | return qe_invalid; | |
| 21586 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getbmap(&temp_zinit.gen_exitState, f)) |
| 21587 | ✗ | return qe_invalid; | |
| 21588 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 198 times.
|
198 | if(!p_getbmap(&temp_zinit.gen_reloadState, f)) |
| 21589 | ✗ | return qe_invalid; | |
| 21590 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 198 times.
|
198 | if(!p_getbmap(&temp_zinit.gen_initd, f)) |
| 21591 | ✗ | return qe_invalid; | |
| 21592 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getbmap(&temp_zinit.gen_eventstate, f)) |
| 21593 | ✗ | return qe_invalid; | |
| 21594 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getbmap(&temp_zinit.gen_data, f)) |
| 21595 | ✗ | return qe_invalid; | |
| 21596 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if(!p_getbmap(&temp_zinit.screen_data, f)) |
| 21597 | ✗ | return qe_invalid; | |
| 21598 |
1/2✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
|
198 | if (s_version >= 38) |
| 21599 | { | ||
| 21600 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if (!p_getc(&temp_zinit.spriteflickerspeed, f)) |
| 21601 | ✗ | return qe_invalid; | |
| 21602 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if (!p_getc(&temp_zinit.spriteflickercolor, f)) |
| 21603 | ✗ | return qe_invalid; | |
| 21604 |
2/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
|
198 | if (!p_getc(&temp_zinit.spriteflickertransp, f)) |
| 21605 | ✗ | return qe_invalid; | |
| 21606 | 198 | } | |
| 21607 |
2/2✓ Branch 0 taken 169 times.
✓ Branch 1 taken 29 times.
|
198 | if(s_version >= 39) |
| 21608 |
2/4✓ Branch 0 taken 169 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 169 times.
✗ Branch 3 not taken.
|
169 | if(!p_igetzf(&temp_zinit.air_drag, f)) |
| 21609 | ✗ | return qe_invalid; | |
| 21610 | |||
| 21611 | // TODO: this first branch can likely be removed, as it only fixes an issues | ||
| 21612 | // that existed for a handful of temporary z3 builds (and active users of that | ||
| 21613 | // fork would have been updating often, beyond s_version 40). | ||
| 21614 |
3/4✓ Branch 0 taken 169 times.
✓ Branch 1 taken 29 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 169 times.
|
198 | if (Header->is_z3 && s_version == 40) |
| 21615 | { | ||
| 21616 | ✗ | if(!p_getc(&temp_zinit.region_mapping, f)) | |
| 21617 | ✗ | return qe_invalid; | |
| 21618 | ✗ | } | |
| 21619 | else | ||
| 21620 | { | ||
| 21621 |
2/2✓ Branch 0 taken 169 times.
✓ Branch 1 taken 29 times.
|
198 | if(s_version >= 40) |
| 21622 | { | ||
| 21623 |
2/4✓ Branch 0 taken 169 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 169 times.
✗ Branch 3 not taken.
|
169 | if(!p_igetw(&temp_zinit.light_wave_rate, f)) |
| 21624 | ✗ | return qe_invalid; | |
| 21625 |
2/4✓ Branch 0 taken 169 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 169 times.
✗ Branch 3 not taken.
|
169 | if(!p_igetw(&temp_zinit.light_wave_size, f)) |
| 21626 | ✗ | return qe_invalid; | |
| 21627 | 169 | } | |
| 21628 | |||
| 21629 |
2/2✓ Branch 0 taken 169 times.
✓ Branch 1 taken 29 times.
|
198 | if(s_version >= 41) |
| 21630 | { | ||
| 21631 |
2/4✓ Branch 0 taken 169 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 169 times.
✗ Branch 3 not taken.
|
169 | if(!p_getc(&temp_zinit.region_mapping, f)) |
| 21632 | ✗ | return qe_invalid; | |
| 21633 | 169 | } | |
| 21634 | } | ||
| 21635 | |||
| 21636 |
2/2✓ Branch 0 taken 35 times.
✓ Branch 1 taken 163 times.
|
198 | if(s_version >= 43) |
| 21637 |
2/2✓ Branch 0 taken 41728 times.
✓ Branch 1 taken 163 times.
|
41891 | for(uint q = 0; q < NUM_BOTTLE_SLOTS; ++q) |
| 21638 |
2/4✓ Branch 0 taken 41728 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 41728 times.
✗ Branch 3 not taken.
|
41728 | if (!p_getc(&temp_zinit.bottle_slot[q], f)) |
| 21639 | 163 | return qe_invalid; | |
| 21640 | |||
| 21641 |
2/2✓ Branch 0 taken 153 times.
✓ Branch 1 taken 45 times.
|
198 | if(s_version >= 44) |
| 21642 |
2/4✓ Branch 0 taken 153 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 153 times.
✗ Branch 3 not taken.
|
153 | if (!p_getbvec(&temp_zinit.lvlswitches, f)) |
| 21643 | ✗ | return qe_invalid; | |
| 21644 | |||
| 21645 |
2/2✓ Branch 0 taken 153 times.
✓ Branch 1 taken 45 times.
|
198 | if (s_version >= 45) |
| 21646 | { | ||
| 21647 |
2/4✓ Branch 0 taken 153 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 153 times.
✗ Branch 3 not taken.
|
153 | if (!p_igetw(&temp_zinit.item_spawn_flicker, f)) |
| 21648 | ✗ | return qe_invalid; | |
| 21649 |
2/4✓ Branch 0 taken 153 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 153 times.
✗ Branch 3 not taken.
|
153 | if (!p_igetw(&temp_zinit.item_timeout_dur, f)) |
| 21650 | ✗ | return qe_invalid; | |
| 21651 |
2/4✓ Branch 0 taken 153 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 153 times.
✗ Branch 3 not taken.
|
153 | if (!p_igetw(&temp_zinit.item_timeout_flicker, f)) |
| 21652 | ✗ | return qe_invalid; | |
| 21653 |
2/4✓ Branch 0 taken 153 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 153 times.
✗ Branch 3 not taken.
|
153 | if (!p_getc(&temp_zinit.item_flicker_speed, f)) |
| 21654 | ✗ | return qe_invalid; | |
| 21655 | 153 | } | |
| 21656 |
2/2✓ Branch 0 taken 45 times.
✓ Branch 1 taken 153 times.
|
198 | if(s_version >= 46) |
| 21657 | { | ||
| 21658 |
2/2✓ Branch 0 taken 765 times.
✓ Branch 1 taken 153 times.
|
918 | for(int q = 0; q < SPRITE_THRESHOLD_MAX; ++q) |
| 21659 |
2/4✓ Branch 0 taken 765 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 765 times.
✗ Branch 3 not taken.
|
765 | if(!p_igetw(&temp_zinit.sprite_z_thresholds[q], f)) |
| 21660 | ✗ | return qe_invalid; | |
| 21661 | 153 | } | |
| 21662 | } | ||
| 21663 | |||
| 21664 |
2/2✓ Branch 0 taken 153 times.
✓ Branch 1 taken 343 times.
|
496 | if(s_version < 46) |
| 21665 | { | ||
| 21666 | 343 | temp_zinit.sprite_z_thresholds[SPRITE_THRESHOLD_GROUND] = temp_zinit.jump_hero_layer_threshold; | |
| 21667 | 343 | temp_zinit.sprite_z_thresholds[SPRITE_THRESHOLD_3] = temp_zinit.jump_hero_layer_threshold; | |
| 21668 | 343 | temp_zinit.sprite_z_thresholds[SPRITE_THRESHOLD_4] = temp_zinit.jump_hero_layer_threshold; | |
| 21669 | 343 | temp_zinit.sprite_z_thresholds[SPRITE_THRESHOLD_OVERHEAD] = word(-1); | |
| 21670 | 343 | temp_zinit.sprite_z_thresholds[SPRITE_THRESHOLD_5] = word(-1); | |
| 21671 | 343 | } | |
| 21672 | |||
| 21673 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | if (should_skip) |
| 21674 | ✗ | return 0; | |
| 21675 | |||
| 21676 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 496 times.
|
496 | if(loading_tileset_flags & TILESET_CLEARMAPS) |
| 21677 | { | ||
| 21678 | ✗ | temp_zinit.last_map = 0; | |
| 21679 | ✗ | temp_zinit.last_screen = 0; | |
| 21680 | ✗ | temp_zinit.screen_data.clear(); | |
| 21681 | ✗ | } | |
| 21682 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | temp_zinit.normalize(); |
| 21683 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | zinit = temp_zinit; |
| 21684 | |||
| 21685 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 496 times.
|
496 | if(zinit.heroAnimationStyle==las_zelda3slow) |
| 21686 | { | ||
| 21687 | ✗ | hero_animation_speed=2; | |
| 21688 | ✗ | } | |
| 21689 | else | ||
| 21690 | { | ||
| 21691 | 496 | hero_animation_speed=1; | |
| 21692 | } | ||
| 21693 | |||
| 21694 | 496 | return 0; | |
| 21695 | 496 | } | |
| 21696 | |||
| 21697 | /* | ||
| 21698 | void setupitemdropsets() | ||
| 21699 | { | ||
| 21700 | for(int32_t i=0; i<isMAX; i++) | ||
| 21701 | { | ||
| 21702 | memcpy(&item_drop_sets[i], &default_item_drop_sets[i], sizeof(item_drop_object)); | ||
| 21703 | } | ||
| 21704 | } | ||
| 21705 | */ | ||
| 21706 | |||
| 21707 | 438 | int32_t readitemdropsets(PACKFILE *f, int32_t version) | |
| 21708 | { | ||
| 21709 |
2/2✓ Branch 0 taken 415 times.
✓ Branch 1 taken 23 times.
|
438 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_itemdropsets); |
| 21710 | |||
| 21711 | dword dummy_dword; | ||
| 21712 | 438 | word item_drop_sets_to_read=0; | |
| 21713 | item_drop_object tempitemdrop; | ||
| 21714 | 438 | word s_version=0; | |
| 21715 | |||
| 21716 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 438 times.
|
438 | if (!should_skip) |
| 21717 |
2/2✓ Branch 0 taken 112128 times.
✓ Branch 1 taken 438 times.
|
112566 | for(int32_t i=0; i<MAXITEMDROPSETS; i++) |
| 21718 | { | ||
| 21719 | 112128 | memset(&item_drop_sets[i], 0, sizeof(item_drop_object)); | |
| 21720 | 112566 | } | |
| 21721 | |||
| 21722 |
2/2✓ Branch 0 taken 415 times.
✓ Branch 1 taken 23 times.
|
438 | if(version > 0x192) |
| 21723 | { | ||
| 21724 | 415 | item_drop_sets_to_read=0; | |
| 21725 | |||
| 21726 | //section version info | ||
| 21727 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(!p_igetw(&s_version,f)) |
| 21728 | { | ||
| 21729 | ✗ | return qe_invalid; | |
| 21730 | } | ||
| 21731 | |||
| 21732 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if (s_version > V_ITEMDROPSETS) |
| 21733 | ✗ | return qe_version; | |
| 21734 | |||
| 21735 | 415 | FFCore.quest_format[vItemDropsets] = s_version; | |
| 21736 | |||
| 21737 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(!read_deprecated_section_cversion(f)) |
| 21738 | { | ||
| 21739 | ✗ | return qe_invalid; | |
| 21740 | } | ||
| 21741 | |||
| 21742 | //section size | ||
| 21743 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(!p_igetl(&dummy_dword,f)) |
| 21744 | { | ||
| 21745 | ✗ | return qe_invalid; | |
| 21746 | } | ||
| 21747 | |||
| 21748 | //finally... section data | ||
| 21749 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(!p_igetw(&item_drop_sets_to_read,f)) |
| 21750 | { | ||
| 21751 | ✗ | return qe_invalid; | |
| 21752 | } | ||
| 21753 | |||
| 21754 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if (item_drop_sets_to_read > MAXITEMDROPSETS) |
| 21755 | { | ||
| 21756 | ✗ | return qe_invalid; | |
| 21757 | } | ||
| 21758 | 415 | } | |
| 21759 | else | ||
| 21760 | { | ||
| 21761 | 23 | init_item_drop_sets(); | |
| 21762 | } | ||
| 21763 | |||
| 21764 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 415 times.
|
438 | if(s_version>=1) |
| 21765 | { | ||
| 21766 |
2/2✓ Branch 0 taken 6388 times.
✓ Branch 1 taken 415 times.
|
6803 | for(int32_t i=0; i<item_drop_sets_to_read; i++) |
| 21767 | { | ||
| 21768 |
1/2✓ Branch 0 taken 6388 times.
✗ Branch 1 not taken.
|
6388 | if(!p_getstr(tempitemdrop.name,sizeof(tempitemdrop.name)-1,f)) |
| 21769 | { | ||
| 21770 | ✗ | return qe_invalid; | |
| 21771 | } | ||
| 21772 | |||
| 21773 |
2/2✓ Branch 0 taken 63880 times.
✓ Branch 1 taken 6388 times.
|
70268 | for(int32_t j=0; j<10; ++j) |
| 21774 | { | ||
| 21775 |
1/2✓ Branch 0 taken 63880 times.
✗ Branch 1 not taken.
|
63880 | if(!p_igetw(&tempitemdrop.item[j],f)) |
| 21776 | { | ||
| 21777 | ✗ | return qe_invalid; | |
| 21778 | } | ||
| 21779 | 63880 | } | |
| 21780 | |||
| 21781 |
2/2✓ Branch 0 taken 70268 times.
✓ Branch 1 taken 6388 times.
|
76656 | for(int32_t j=0; j<11; ++j) |
| 21782 | { | ||
| 21783 |
1/2✓ Branch 0 taken 70268 times.
✗ Branch 1 not taken.
|
70268 | if(!p_igetw(&tempitemdrop.chance[j],f)) |
| 21784 | { | ||
| 21785 | ✗ | return qe_invalid; | |
| 21786 | } | ||
| 21787 | 70268 | } | |
| 21788 | |||
| 21789 | // Dec 2008: Addition of the 'Tall Grass' set, #12, | ||
| 21790 | // overrides the quest's set #12. | ||
| 21791 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6388 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6388 | if(s_version<2 && i==12) |
| 21792 | ✗ | continue; | |
| 21793 | |||
| 21794 | // Deprecated: qr_NOCLOCKS and qr_ALLOW10RUPEEDROPS | ||
| 21795 |
1/4✓ Branch 0 taken 6388 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6388 | if(s_version<2) for(int32_t j=0; j<10; ++j) |
| 21796 | { | ||
| 21797 | ✗ | int32_t it = tempitemdrop.item[j]; | |
| 21798 | |||
| 21799 | ✗ | if((itemsbuf[it].type == itype_rupee | |
| 21800 | ✗ | && ((itemsbuf[it].amount)&0xFFF) == 10) | |
| 21801 | ✗ | && !get_bit(deprecated_rules, qr_ALLOW10RUPEEDROPS_DEP)) | |
| 21802 | { | ||
| 21803 | ✗ | tempitemdrop.chance[j+1]=0; | |
| 21804 | ✗ | } | |
| 21805 | ✗ | else if(itemsbuf[it].type == itype_clock && get_bit(deprecated_rules, qr_NOCLOCKS_DEP)) | |
| 21806 | { | ||
| 21807 | ✗ | tempitemdrop.chance[j+1]=0; | |
| 21808 | ✗ | } | |
| 21809 | |||
| 21810 | // From Sept 2007 to Dec 2008, non-gameplay items were prohibited. | ||
| 21811 | ✗ | if(itemsbuf[it].type == itype_misc) | |
| 21812 | { | ||
| 21813 | // If a non-gameplay item was selected, then item drop was aborted. | ||
| 21814 | // Reflect this by increasing the 'Nothing' chance accordingly. | ||
| 21815 | ✗ | tempitemdrop.chance[0]+=tempitemdrop.chance[j+1]; | |
| 21816 | ✗ | tempitemdrop.chance[j+1]=0; | |
| 21817 | ✗ | } | |
| 21818 | ✗ | } | |
| 21819 | |||
| 21820 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6388 times.
|
6388 | if (!should_skip) |
| 21821 | 6388 | memcpy(&item_drop_sets[i], &tempitemdrop, sizeof(item_drop_object)); | |
| 21822 | 6388 | } | |
| 21823 | 415 | } | |
| 21824 | |||
| 21825 | 438 | return 0; | |
| 21826 | 438 | } | |
| 21827 | |||
| 21828 | 415 | int32_t readfavorites(PACKFILE *f, int32_t) | |
| 21829 | { | ||
| 21830 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_favorites); |
| 21831 | |||
| 21832 | int32_t temp_num; | ||
| 21833 | dword dummy_dword; | ||
| 21834 | word num_favorite_combos; | ||
| 21835 | word num_favorite_combo_aliases; | ||
| 21836 | 415 | word s_version=0; | |
| 21837 | |||
| 21838 | //section version info | ||
| 21839 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(!p_igetw(&s_version,f)) |
| 21840 | { | ||
| 21841 | ✗ | return qe_invalid; | |
| 21842 | } | ||
| 21843 | |||
| 21844 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if (s_version > V_FAVORITES) |
| 21845 | ✗ | return qe_version; | |
| 21846 | |||
| 21847 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if (!should_skip) |
| 21848 | 415 | FFCore.quest_format[vFavourites] = s_version; | |
| 21849 | |||
| 21850 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(!read_deprecated_section_cversion(f)) |
| 21851 | { | ||
| 21852 | ✗ | return qe_invalid; | |
| 21853 | } | ||
| 21854 | |||
| 21855 | //section size | ||
| 21856 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(!p_igetl(&dummy_dword,f)) |
| 21857 | { | ||
| 21858 | ✗ | return qe_invalid; | |
| 21859 | } | ||
| 21860 | |||
| 21861 | 415 | word per_row = FAVORITECOMBO_PER_ROW; | |
| 21862 | 415 | word per_page = FAVORITECOMBO_PER_PAGE; | |
| 21863 |
2/2✓ Branch 0 taken 211 times.
✓ Branch 1 taken 204 times.
|
415 | if(s_version >= 3) |
| 21864 |
1/2✓ Branch 0 taken 204 times.
✗ Branch 1 not taken.
|
204 | if(!p_igetw(&per_row,f)) |
| 21865 | ✗ | return qe_invalid; | |
| 21866 |
2/2✓ Branch 0 taken 217 times.
✓ Branch 1 taken 198 times.
|
415 | if(s_version >= 4) |
| 21867 |
1/2✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
|
198 | if(!p_igetw(&per_page,f)) |
| 21868 | ✗ | return qe_invalid; | |
| 21869 | //finally... section data | ||
| 21870 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | if(!p_igetw(&num_favorite_combos,f)) |
| 21871 | { | ||
| 21872 | ✗ | return qe_invalid; | |
| 21873 | } | ||
| 21874 | |||
| 21875 | //Hack; port old favorite combos | ||
| 21876 |
3/4✓ Branch 0 taken 211 times.
✓ Branch 1 taken 204 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 211 times.
|
415 | if(s_version < 3 && num_favorite_combos == 100) |
| 21877 | 211 | per_row = 13; | |
| 21878 | |||
| 21879 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if (!should_skip) |
| 21880 |
2/2✓ Branch 0 taken 522900 times.
✓ Branch 1 taken 415 times.
|
523315 | for(int q = 0; q < MAXFAVORITECOMBOS; ++q) |
| 21881 | 523315 | favorite_combos[q] = -1; | |
| 21882 | 415 | byte favtype = 0; | |
| 21883 |
2/2✓ Branch 0 taken 28021 times.
✓ Branch 1 taken 415 times.
|
28436 | for(int32_t i=0; i<num_favorite_combos; i++) |
| 21884 | { | ||
| 21885 |
2/2✓ Branch 0 taken 6915 times.
✓ Branch 1 taken 21106 times.
|
28021 | if (s_version >= 4) |
| 21886 | { | ||
| 21887 |
1/2✓ Branch 0 taken 6915 times.
✗ Branch 1 not taken.
|
6915 | if (!p_getc(&favtype, f)) |
| 21888 | { | ||
| 21889 | ✗ | return qe_invalid; | |
| 21890 | } | ||
| 21891 | 6915 | } | |
| 21892 | else | ||
| 21893 | 21106 | favtype = 0; | |
| 21894 |
1/2✓ Branch 0 taken 28021 times.
✗ Branch 1 not taken.
|
28021 | if(!p_igetl(&temp_num,f)) |
| 21895 | { | ||
| 21896 | ✗ | return qe_invalid; | |
| 21897 | } | ||
| 21898 | |||
| 21899 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28021 times.
|
28021 | if (should_skip) |
| 21900 | ✗ | continue; | |
| 21901 | |||
| 21902 |
2/2✓ Branch 0 taken 6915 times.
✓ Branch 1 taken 21106 times.
|
28021 | if(per_row == FAVORITECOMBO_PER_ROW) |
| 21903 | { | ||
| 21904 | 6915 | favorite_combos[i] = temp_num; | |
| 21905 | 6915 | favorite_combo_modes[i] = favtype; | |
| 21906 | 6915 | } | |
| 21907 | else | ||
| 21908 | { | ||
| 21909 | 21106 | int new_i = (i%per_row) + (i/per_row)*FAVORITECOMBO_PER_ROW; | |
| 21910 | 21106 | favorite_combos[new_i]=temp_num; | |
| 21911 | 21106 | favorite_combo_modes[new_i] = favtype; | |
| 21912 | } | ||
| 21913 | 28021 | } | |
| 21914 | |||
| 21915 | // Discard the separate favorite aliases list from previous versions | ||
| 21916 |
2/2✓ Branch 0 taken 198 times.
✓ Branch 1 taken 217 times.
|
415 | if(s_version<4) |
| 21917 | { | ||
| 21918 |
1/2✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
|
217 | if (!p_igetw(&num_favorite_combo_aliases, f)) |
| 21919 | { | ||
| 21920 | ✗ | return qe_invalid; | |
| 21921 | } | ||
| 21922 | |||
| 21923 |
2/2✓ Branch 0 taken 21100 times.
✓ Branch 1 taken 217 times.
|
21317 | for (int32_t i = 0; i < num_favorite_combo_aliases; i++) |
| 21924 | { | ||
| 21925 |
1/2✓ Branch 0 taken 21100 times.
✗ Branch 1 not taken.
|
21100 | if (!p_igetl(&temp_num, f)) |
| 21926 | { | ||
| 21927 | ✗ | return qe_invalid; | |
| 21928 | } | ||
| 21929 | 21100 | } | |
| 21930 | 217 | } | |
| 21931 | |||
| 21932 | 415 | word max_combo_cols = 0; | |
| 21933 | 415 | word max_mappages = 0; | |
| 21934 |
2/2✓ Branch 0 taken 211 times.
✓ Branch 1 taken 204 times.
|
415 | if(s_version >= 2) |
| 21935 | { | ||
| 21936 |
1/2✓ Branch 0 taken 204 times.
✗ Branch 1 not taken.
|
204 | if(!p_igetw(&max_combo_cols,f)) |
| 21937 | ✗ | return qe_invalid; | |
| 21938 | 204 | int32_t tmp = 0, tmp2 = 0, tmp3 = 0; | |
| 21939 |
2/2✓ Branch 0 taken 816 times.
✓ Branch 1 taken 204 times.
|
1020 | for(int q = 0; q < max_combo_cols; ++q) |
| 21940 | { | ||
| 21941 |
1/2✓ Branch 0 taken 816 times.
✗ Branch 1 not taken.
|
816 | if(!p_igetl(&tmp,f)) |
| 21942 | ✗ | return qe_invalid; | |
| 21943 |
1/2✓ Branch 0 taken 816 times.
✗ Branch 1 not taken.
|
816 | if(!p_igetl(&tmp2,f)) |
| 21944 | ✗ | return qe_invalid; | |
| 21945 |
1/2✓ Branch 0 taken 816 times.
✗ Branch 1 not taken.
|
816 | if(!p_igetl(&tmp3,f)) |
| 21946 | ✗ | return qe_invalid; | |
| 21947 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 816 times.
|
816 | if(q < MAX_COMBO_COLS) |
| 21948 | { | ||
| 21949 | 816 | First[q] = tmp; | |
| 21950 | 816 | combo_alistpos[q] = tmp2; | |
| 21951 | 816 | combo_pool_listpos[q] = tmp3; | |
| 21952 | 816 | } | |
| 21953 | 816 | } | |
| 21954 | |||
| 21955 |
1/2✓ Branch 0 taken 204 times.
✗ Branch 1 not taken.
|
204 | if(!p_igetw(&max_mappages,f)) |
| 21956 | ✗ | return qe_invalid; | |
| 21957 |
2/2✓ Branch 0 taken 1836 times.
✓ Branch 1 taken 204 times.
|
2040 | for(int q = 0; q < max_mappages; ++q) |
| 21958 | { | ||
| 21959 |
1/2✓ Branch 0 taken 1836 times.
✗ Branch 1 not taken.
|
1836 | if(!p_igetl(&tmp,f)) |
| 21960 | ✗ | return qe_invalid; | |
| 21961 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1836 times.
|
1836 | if(!p_igetl(&tmp2,f)) |
| 21962 | ✗ | return qe_invalid; | |
| 21963 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1836 times.
|
1836 | if(q < MAX_MAPPAGE_BTNS) |
| 21964 | { | ||
| 21965 | 1836 | map_page[q].map = tmp; | |
| 21966 | 1836 | map_page[q].screen = tmp2; | |
| 21967 | 1836 | } | |
| 21968 | 1836 | } | |
| 21969 | 204 | } | |
| 21970 | |||
| 21971 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if (should_skip) |
| 21972 | ✗ | return 0; | |
| 21973 | |||
| 21974 |
2/2✓ Branch 0 taken 844 times.
✓ Branch 1 taken 415 times.
|
1259 | for(int q = max_combo_cols; q < MAX_COMBO_COLS; ++q) |
| 21975 | { | ||
| 21976 | 844 | First[q] = 0; | |
| 21977 | 844 | combo_alistpos[q] = 0; | |
| 21978 | 844 | combo_pool_listpos[q] = 0; | |
| 21979 | 844 | } | |
| 21980 |
2/2✓ Branch 0 taken 1899 times.
✓ Branch 1 taken 415 times.
|
2314 | for(int q = max_mappages; q < MAX_MAPPAGE_BTNS; ++q) |
| 21981 | { | ||
| 21982 | 1899 | map_page[q].map = 0; | |
| 21983 | 1899 | map_page[q].screen = 0; | |
| 21984 | 1899 | } | |
| 21985 | |||
| 21986 | 415 | return 0; | |
| 21987 | 415 | } | |
| 21988 | |||
| 21989 | 132 | int32_t read_adv_music(PACKFILE *f) | |
| 21990 | { | ||
| 21991 | 132 | word s_version = 0; | |
| 21992 | dword section_size; | ||
| 21993 | |||
| 21994 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
|
132 | if(!p_igetw(&s_version,f)) |
| 21995 | ✗ | return qe_invalid; | |
| 21996 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
|
132 | if (s_version > V_ADVMUSIC) |
| 21997 | ✗ | return qe_version; | |
| 21998 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(!read_deprecated_section_cversion(f)) |
| 21999 | ✗ | return qe_invalid; | |
| 22000 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(!p_igetl(§ion_size,f)) |
| 22001 | ✗ | return qe_invalid; | |
| 22002 | |||
| 22003 | 132 | word count = 0; | |
| 22004 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if (!p_igetw(&count, f)) |
| 22005 | ✗ | return qe_invalid; | |
| 22006 | |||
| 22007 | 132 | quest_music.clear(); | |
| 22008 |
2/2✓ Branch 0 taken 266 times.
✓ Branch 1 taken 132 times.
|
398 | for (size_t q = 0; q < count; ++q) |
| 22009 | { | ||
| 22010 | 266 | AdvancedMusic& m = quest_music.emplace_back(); | |
| 22011 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 266 times.
|
266 | if (auto ret = m.read(f, s_version)) |
| 22012 | ✗ | return ret; | |
| 22013 | 266 | m.id = q + 1; | |
| 22014 | 266 | } | |
| 22015 | 132 | return 0; | |
| 22016 | 132 | } | |
| 22017 | |||
| 22018 | /* | ||
| 22019 | switch (ret) { | ||
| 22020 | case 0: | ||
| 22021 | break; | ||
| 22022 | |||
| 22023 | case qe_invalid: | ||
| 22024 | goto invalid; | ||
| 22025 | break; | ||
| 22026 | default: | ||
| 22027 | pack_fclose(f); | ||
| 22028 | if(!oldquest) | ||
| 22029 | delete_file(tmpfilename); | ||
| 22030 | return ret; | ||
| 22031 | break; | ||
| 22032 | } | ||
| 22033 | */ | ||
| 22034 | |||
| 22035 | const char *skip_text[skip_max]= | ||
| 22036 | { | ||
| 22037 | "skip_header", "skip_rules", "skip_strings", "skip_misc", | ||
| 22038 | "skip_tiles", "skip_combos", "skip_comboaliases", "skip_csets", | ||
| 22039 | "skip_maps", "skip_dmaps", "skip_doors", "skip_items", | ||
| 22040 | "skip_weapons", "skip_colors", "skip_icons", "skip_initdata", | ||
| 22041 | "skip_guys", "skip_herosprites", "skip_subscreens", "skip_ffscript", | ||
| 22042 | "skip_sfx", "skip_midis", "skip_cheats", "skip_itemdropsets", | ||
| 22043 | "skip_favorites", "skip_zinfo", "skip_adv_music" | ||
| 22044 | }; | ||
| 22045 | |||
| 22046 | |||
| 22047 | ✗ | void port250QuestRules(){ | |
| 22048 | |||
| 22049 | ✗ | portCandleRules(); //Candle | |
| 22050 | ✗ | portBombRules(); | |
| 22051 | |||
| 22052 | ✗ | } | |
| 22053 | |||
| 22054 | ✗ | void portCandleRules() | |
| 22055 | { | ||
| 22056 | ✗ | bool hurtshero = get_qr(qr_FIREPROOFHERO); | |
| 22057 | //itemdata itemsbuf; | ||
| 22058 | ✗ | for ( int32_t q = 0; q < MAXITEMS; q++ ) | |
| 22059 | { | ||
| 22060 | ✗ | if ( itemsbuf[q].type == itype_candle ) | |
| 22061 | { | ||
| 22062 | ✗ | if ( hurtshero ) itemsbuf[q].flags |= item_flag2; | |
| 22063 | ✗ | else itemsbuf[q].flags &= ~ item_flag2; | |
| 22064 | ✗ | } | |
| 22065 | ✗ | } | |
| 22066 | ✗ | } | |
| 22067 | |||
| 22068 | ✗ | void portBombRules() | |
| 22069 | { | ||
| 22070 | ✗ | bool hurtshero = get_qr(qr_OUCHBOMBS); | |
| 22071 | //itemdata itemsbuf; | ||
| 22072 | ✗ | for ( int32_t q = 0; q < MAXITEMS; q++ ) | |
| 22073 | { | ||
| 22074 | ✗ | if ( itemsbuf[q].type == itype_bomb ) | |
| 22075 | { | ||
| 22076 | ✗ | if ( hurtshero ) itemsbuf[q].flags |= item_flag2; | |
| 22077 | ✗ | else itemsbuf[q].flags &= ~ item_flag2; | |
| 22078 | ✗ | } | |
| 22079 | ✗ | } | |
| 22080 | ✗ | } | |
| 22081 | |||
| 22082 | 19362 | static int section_id_to_enum(int id) | |
| 22083 | { | ||
| 22084 |
25/28✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 830 times.
✓ Branch 3 taken 830 times.
✓ Branch 4 taken 830 times.
✓ Branch 5 taken 830 times.
✓ Branch 6 taken 830 times.
✓ Branch 7 taken 748 times.
✓ Branch 8 taken 830 times.
✓ Branch 9 taken 830 times.
✓ Branch 10 taken 830 times.
✓ Branch 11 taken 830 times.
✓ Branch 12 taken 830 times.
✓ Branch 13 taken 830 times.
✓ Branch 14 taken 748 times.
✓ Branch 15 taken 748 times.
✓ Branch 16 taken 830 times.
✓ Branch 17 taken 830 times.
✓ Branch 18 taken 772 times.
✓ Branch 19 taken 748 times.
✓ Branch 20 taken 748 times.
✓ Branch 21 taken 748 times.
✓ Branch 22 taken 830 times.
✓ Branch 23 taken 830 times.
✓ Branch 24 taken 772 times.
✓ Branch 25 taken 748 times.
✗ Branch 26 not taken.
✓ Branch 27 taken 132 times.
|
19362 | switch (id) |
| 22085 | { | ||
| 22086 | ✗ | case ID_HEADER: return skip_header; | |
| 22087 | 830 | case ID_RULES: return skip_rules; | |
| 22088 | 830 | case ID_STRINGS: return skip_strings; | |
| 22089 | 830 | case ID_MISC: return skip_misc; | |
| 22090 | 830 | case ID_TILES: return skip_tiles; | |
| 22091 | 830 | case ID_COMBOS: return skip_combos; | |
| 22092 | 748 | case ID_COMBOALIASES: return skip_comboaliases; | |
| 22093 | 830 | case ID_CSETS: return skip_csets; | |
| 22094 | 830 | case ID_MAPS: return skip_maps; | |
| 22095 | 830 | case ID_DMAPS: return skip_dmaps; | |
| 22096 | 830 | case ID_DOORS: return skip_doors; | |
| 22097 | 830 | case ID_ITEMS: return skip_items; | |
| 22098 | 830 | case ID_WEAPONS: return skip_weapons; | |
| 22099 | 748 | case ID_COLORS: return skip_colors; | |
| 22100 | 748 | case ID_ICONS: return skip_icons; | |
| 22101 | 830 | case ID_INITDATA: return skip_initdata; | |
| 22102 | 830 | case ID_GUYS: return skip_guys; | |
| 22103 | 772 | case ID_HEROSPRITES: return skip_herosprites; | |
| 22104 | 748 | case ID_SUBSCREEN: return skip_subscreens; | |
| 22105 | 748 | case ID_FFSCRIPT: return skip_ffscript; | |
| 22106 | 748 | case ID_SFX: return skip_sfx; | |
| 22107 | 830 | case ID_MIDIS: return skip_midis; | |
| 22108 | 830 | case ID_CHEATS: return skip_cheats; | |
| 22109 | 772 | case ID_ITEMDROPSETS: return skip_itemdropsets; | |
| 22110 | 748 | case ID_FAVORITES: return skip_favorites; | |
| 22111 | ✗ | case ID_ZINFO: return skip_zinfo; | |
| 22112 | 132 | case ID_ADVMUSIC: return skip_adv_music; | |
| 22113 | } | ||
| 22114 | |||
| 22115 | ✗ | return -1; | |
| 22116 | 19362 | } | |
| 22117 | |||
| 22118 | 18954 | static int maybe_skip_section(PACKFILE* f, dword& section_id, const byte* skip_flags) | |
| 22119 | { | ||
| 22120 | 18954 | int section_enum = section_id_to_enum(section_id); | |
| 22121 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18954 times.
|
18954 | bool skip = section_enum >= 0 && get_bit(skip_flags, section_enum); |
| 22122 |
2/2✓ Branch 0 taken 6993 times.
✓ Branch 1 taken 11961 times.
|
18954 | if (skip) |
| 22123 | { | ||
| 22124 | word s_version; | ||
| 22125 |
1/2✓ Branch 0 taken 6993 times.
✗ Branch 1 not taken.
|
6993 | if (!p_igetw(&s_version,f)) |
| 22126 | { | ||
| 22127 | ✗ | return qe_invalid; | |
| 22128 | } | ||
| 22129 | |||
| 22130 |
1/2✓ Branch 0 taken 6993 times.
✗ Branch 1 not taken.
|
6993 | if (!read_deprecated_section_cversion(f)) |
| 22131 | { | ||
| 22132 | ✗ | return qe_invalid; | |
| 22133 | } | ||
| 22134 | |||
| 22135 |
3/4✓ Branch 0 taken 333 times.
✓ Branch 1 taken 6660 times.
✓ Branch 2 taken 333 times.
✗ Branch 3 not taken.
|
6993 | if (section_id == ID_RULES && s_version > 16) |
| 22136 | { | ||
| 22137 | dword dummy; | ||
| 22138 | ✗ | if (!p_igetl(&dummy,f)) | |
| 22139 | { | ||
| 22140 | ✗ | return qe_invalid; | |
| 22141 | } | ||
| 22142 | ✗ | } | |
| 22143 | |||
| 22144 |
3/4✓ Branch 0 taken 333 times.
✓ Branch 1 taken 6660 times.
✓ Branch 2 taken 333 times.
✗ Branch 3 not taken.
|
6993 | if (section_id == ID_FFSCRIPT && s_version >= 18) |
| 22145 | { | ||
| 22146 | word dummy; | ||
| 22147 | ✗ | if (!p_igetw(&dummy,f)) | |
| 22148 | { | ||
| 22149 | ✗ | return qe_invalid; | |
| 22150 | } | ||
| 22151 | ✗ | } | |
| 22152 | |||
| 22153 | dword section_length; | ||
| 22154 |
1/2✓ Branch 0 taken 6993 times.
✗ Branch 1 not taken.
|
6993 | if (!p_igetl(§ion_length,f)) |
| 22155 | { | ||
| 22156 | ✗ | return qe_invalid; | |
| 22157 | } | ||
| 22158 | |||
| 22159 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6993 times.
|
6993 | if (pack_fseek(f, section_length)) |
| 22160 | { | ||
| 22161 | ✗ | return qe_invalid; | |
| 22162 | } | ||
| 22163 | |||
| 22164 |
2/2✓ Branch 0 taken 333 times.
✓ Branch 1 taken 6660 times.
|
6993 | if (!pack_feof(f)) |
| 22165 | { | ||
| 22166 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6660 times.
|
6660 | if (!p_mgetl(§ion_id,f)) |
| 22167 | { | ||
| 22168 | ✗ | return qe_invalid; | |
| 22169 | } | ||
| 22170 | 6660 | } | |
| 22171 | |||
| 22172 | 6993 | return qe_cancel; | |
| 22173 | } | ||
| 22174 | |||
| 22175 | 11961 | return qe_OK; | |
| 22176 | 18954 | } | |
| 22177 | |||
| 22178 | // TODO: this was copied from zc/zasm_utils.cpp | ||
| 22179 | 283 | static void _zasm_for_every_script(std::function<void(zasm_script*)> fn) | |
| 22180 | { | ||
| 22181 | extern std::vector<std::shared_ptr<zasm_script>> zasm_scripts; | ||
| 22182 | |||
| 22183 | 283 | std::vector<zasm_script*> scripts; | |
| 22184 |
1/2✓ Branch 0 taken 283 times.
✗ Branch 1 not taken.
|
283 | scripts.reserve(zasm_scripts.size()); |
| 22185 |
2/2✓ Branch 0 taken 283 times.
✓ Branch 1 taken 305182 times.
|
305465 | for (auto& script : zasm_scripts) |
| 22186 |
2/2✓ Branch 0 taken 296700 times.
✓ Branch 1 taken 8482 times.
|
305182 | if (script->valid()) |
| 22187 |
1/2✓ Branch 0 taken 8482 times.
✗ Branch 1 not taken.
|
8482 | scripts.push_back(script.get()); |
| 22188 | |||
| 22189 |
2/4✓ Branch 0 taken 283 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 283 times.
✗ Branch 3 not taken.
|
283 | std::for_each(scripts.begin(), scripts.end(), fn); |
| 22190 | 283 | } | |
| 22191 | |||
| 22192 | 496 | static bool compat_qr_hide_bottom_pixels(const zquestheader& header) | |
| 22193 | { | ||
| 22194 | // 2.55.9 or newer? | ||
| 22195 |
2/2✓ Branch 0 taken 170 times.
✓ Branch 1 taken 326 times.
|
496 | if (header.compareVer(2, 55, 9) >= 0) |
| 22196 | 170 | return false; // defer to whatever was set | |
| 22197 | |||
| 22198 | // Replays created in 2.55 for quests prior to 2.55.9 should continue hiding the bottom pixels. | ||
| 22199 |
12/18✓ Branch 0 taken 50 times.
✓ Branch 1 taken 276 times.
✓ Branch 2 taken 276 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 276 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 50 times.
✓ Branch 7 taken 276 times.
✓ Branch 8 taken 50 times.
✓ Branch 9 taken 276 times.
✓ Branch 10 taken 50 times.
✓ Branch 11 taken 276 times.
✓ Branch 12 taken 37 times.
✓ Branch 13 taken 289 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
326 | if (replay_is_replaying() && replay_get_meta_str("zc_version_created").starts_with("2.55")) |
| 22200 | 37 | return true; | |
| 22201 | |||
| 22202 | // Quests prior to 2.55.9 with a scripted subscreen? | ||
| 22203 |
2/2✓ Branch 0 taken 146435 times.
✓ Branch 1 taken 286 times.
|
146721 | for (int i = 0; i < MAXDMAPS; i++) |
| 22204 | { | ||
| 22205 | 146435 | int script = DMaps[i].active_sub_script; | |
| 22206 |
4/6✓ Branch 0 taken 3 times.
✓ Branch 1 taken 146432 times.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
|
146435 | if (script && dmapscripts[script] && dmapscripts[script]->valid()) |
| 22207 | 3 | return true; | |
| 22208 | 146432 | } | |
| 22209 | |||
| 22210 | // Only a couple quests take any time (~7ms) on my intel mac to check all the ZASM... cache those. | ||
| 22211 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | std::string title = header.title; |
| 22212 |
3/4✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 283 times.
|
286 | if (title == "Yuurand: Tales of the Labyrinth") |
| 22213 | 3 | return true; | |
| 22214 | |||
| 22215 | // Look for ZASM setting values of 167, 168, etc. This is a sign that the script may be drawing something | ||
| 22216 | // near the old "bottom" of the screen, or is attempting to fill the entire screen with a draw command. | ||
| 22217 | // In these cases, the compat rule must be flipped on. As of writing, 72 quests in the PZC database match | ||
| 22218 | // this query: https://gist.github.com/connorjclark/edd12f84c9aac0c924ed328d3f8efcfa | ||
| 22219 | 283 | bool found = false; | |
| 22220 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 283 times.
|
8765 | _zasm_for_every_script([&](auto script){ |
| 22221 |
2/2✓ Branch 0 taken 3033 times.
✓ Branch 1 taken 5449 times.
|
8482 | if (found) return; |
| 22222 | |||
| 22223 |
2/2✓ Branch 0 taken 5419 times.
✓ Branch 1 taken 23840130 times.
|
23845549 | for (const auto& instr : script->zasm) |
| 22224 | { | ||
| 22225 |
4/4✓ Branch 0 taken 20882211 times.
✓ Branch 1 taken 2957919 times.
✓ Branch 2 taken 358211 times.
✓ Branch 3 taken 20524000 times.
|
23840130 | if (!(instr.command == SETV || instr.command == PUSHV)) continue; |
| 22226 | |||
| 22227 | 3316130 | int value = instr.arg2; | |
| 22228 |
9/10✓ Branch 0 taken 3316128 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 3316125 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 3316101 times.
✓ Branch 5 taken 24 times.
✓ Branch 6 taken 3316101 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 3316100 times.
|
3316130 | if (value == 167000000 || value == 168000000 || value == 167870000 || value == 167910000 || value == 168130000) |
| 22229 | { | ||
| 22230 | 30 | found = true; | |
| 22231 | 30 | break; | |
| 22232 | } | ||
| 22233 | } | ||
| 22234 | 8482 | }); | |
| 22235 | |||
| 22236 | 283 | return found; | |
| 22237 | 496 | } | |
| 22238 | |||
| 22239 | static int32_t prev_quest_format[versiontypesLAST]; | ||
| 22240 | static byte prev_quest_rules[QUESTRULES_NEW_SIZE]; | ||
| 22241 | static byte prev_extra_rules[EXTRARULES_SIZE]; | ||
| 22242 | static byte prev_midi_flags[MIDIFLAGS_SIZE]; | ||
| 22243 | static word prev_map_count; | ||
| 22244 | |||
| 22245 | // When skipping any section, we are loading a qst file just to poke at a couple things. | ||
| 22246 | // We should not mutate important globals in that case. | ||
| 22247 | // We should also restore these globals when loading a qst fails. | ||
| 22248 | // Globals that are read by usecases of `skip_flags` will have to be restored manually by the caller | ||
| 22249 | // (see load_imagebuf). | ||
| 22250 | 830 | static void store_prev_qstload_global_state() | |
| 22251 | { | ||
| 22252 | 830 | memcpy(prev_quest_rules, quest_rules, QUESTRULES_NEW_SIZE); | |
| 22253 | 830 | memcpy(prev_extra_rules, extra_rules, EXTRARULES_SIZE); | |
| 22254 | 830 | memcpy(prev_midi_flags, midi_flags, MIDIFLAGS_SIZE); | |
| 22255 | 830 | memcpy(prev_quest_format, FFCore.quest_format, versiontypesLAST); | |
| 22256 | 830 | prev_map_count = map_count; | |
| 22257 | 830 | } | |
| 22258 | |||
| 22259 | 334 | static void restore_prev_qstload_global_state() | |
| 22260 | { | ||
| 22261 | 334 | memcpy(quest_rules, prev_quest_rules, QUESTRULES_NEW_SIZE); | |
| 22262 | 334 | memcpy(extra_rules, prev_extra_rules, EXTRARULES_SIZE); | |
| 22263 | 334 | unpack_qrs(); | |
| 22264 | 334 | memcpy(midi_flags, prev_midi_flags, MIDIFLAGS_SIZE); | |
| 22265 | 334 | memcpy(FFCore.quest_format, prev_quest_format, versiontypesLAST); | |
| 22266 | 334 | map_count = prev_map_count; | |
| 22267 | 334 | } | |
| 22268 | |||
| 22269 | //Internal function for loadquest wrapper | ||
| 22270 | // TODO: refactor to never mutate global state, to make loading partial qst files easier and less error prone. huge project. | ||
| 22271 | 830 | static int32_t _lq_int(const char *filename, zquestheader *Header, miscQdata *Misc, zctune *tunes, bool show_progress, byte *skip_flags, byte printmetadata) | |
| 22272 | { | ||
| 22273 | 830 | DMapEditorLastMaptileUsed = 0; | |
| 22274 | 830 | combosread=false; | |
| 22275 | 830 | mapsread=false; | |
| 22276 | 830 | fixffcs=false; | |
| 22277 | |||
| 22278 | 830 | store_prev_qstload_global_state(); | |
| 22279 | |||
| 22280 | 830 | bool skipping_any = false; | |
| 22281 |
2/2✓ Branch 0 taken 3320 times.
✓ Branch 1 taken 830 times.
|
4150 | for (int i = 0; i < 4; i++) |
| 22282 | 3320 | skipping_any |= skip_flags[i] ? true : false; | |
| 22283 | |||
| 22284 | 830 | bool do_clear_scripts = !get_bit(skip_flags,skip_ffscript); | |
| 22285 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 22286 | { | ||
| 22287 | ✗ | set_bit(skip_flags, skip_ffscript, 1); | |
| 22288 | ✗ | setZScriptVersion(V_FFSCRIPT); | |
| 22289 | ✗ | FFCore.quest_format[vFFScript] = V_FFSCRIPT; | |
| 22290 | ✗ | FFCore.quest_format[vLastCompile] = V_FFSCRIPT; | |
| 22291 | ✗ | do_clear_scripts = true; | |
| 22292 | ✗ | } | |
| 22293 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | if(loading_tileset_flags & TILESET_CLEARMAPS) |
| 22294 | { | ||
| 22295 | ✗ | set_bit(skip_flags, skip_maps, 1); | |
| 22296 | ✗ | } | |
| 22297 | |||
| 22298 | char tmpfilename[L_tmpnam]; | ||
| 22299 | 830 | temp_name(tmpfilename); | |
| 22300 | 830 | bool catchup=false; | |
| 22301 | byte tempbyte; | ||
| 22302 | |||
| 22303 | // oldquest flag is set when an unencrypted qst file is suspected. | ||
| 22304 | 830 | bool oldquest = false; | |
| 22305 | 830 | int32_t open_error=0; | |
| 22306 | 830 | PACKFILE *f=open_quest_file(&open_error, filename, show_progress); | |
| 22307 | |||
| 22308 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 830 times.
|
830 | if (!f) |
| 22309 | { | ||
| 22310 | ASSERT(open_error != 0); | ||
| 22311 | ✗ | return open_error; | |
| 22312 | } | ||
| 22313 | |||
| 22314 | 830 | memset(quest_rules, 0, QUESTRULES_NEW_SIZE); | |
| 22315 | 830 | memset(extra_rules, 0, EXTRARULES_SIZE); | |
| 22316 | 830 | unpack_qrs(); | |
| 22317 | |||
| 22318 |
2/2✓ Branch 0 taken 334 times.
✓ Branch 1 taken 496 times.
|
830 | if (!get_bit(skip_flags, skip_maps)) |
| 22319 | 496 | Regions = {}; | |
| 22320 | |||
| 22321 |
3/4✓ Branch 0 taken 334 times.
✓ Branch 1 taken 496 times.
✓ Branch 2 taken 334 times.
✗ Branch 3 not taken.
|
1164 | if (!(get_bit(skip_flags, skip_dmaps) && |
| 22322 |
1/2✓ Branch 0 taken 334 times.
✗ Branch 1 not taken.
|
334 | get_bit(skip_flags, skip_maps) && |
| 22323 | 334 | get_bit(skip_flags, skip_adv_music))) | |
| 22324 | 496 | quest_music.clear(); // dmaps/maps of old quests will create advanced music | |
| 22325 | |||
| 22326 |
2/2✓ Branch 0 taken 334 times.
✓ Branch 1 taken 496 times.
|
830 | if(do_clear_scripts) |
| 22327 | { | ||
| 22328 | 496 | zScript.clear(); | |
| 22329 | 496 | globalmap.clear(); | |
| 22330 | 496 | genericmap.clear(); | |
| 22331 | 496 | ffcmap.clear(); | |
| 22332 | 496 | itemmap.clear(); | |
| 22333 | 496 | npcmap.clear(); | |
| 22334 | 496 | ewpnmap.clear(); | |
| 22335 | 496 | lwpnmap.clear(); | |
| 22336 | 496 | playermap.clear(); | |
| 22337 | 496 | dmapmap.clear(); | |
| 22338 | 496 | screenmap.clear(); | |
| 22339 | 496 | itemspritemap.clear(); | |
| 22340 | 496 | comboscriptmap.clear(); | |
| 22341 | 496 | subscreenmap.clear(); | |
| 22342 | |||
| 22343 |
2/2✓ Branch 0 taken 253456 times.
✓ Branch 1 taken 496 times.
|
253952 | for(int32_t i=0; i<NUMSCRIPTFFC-1; i++) |
| 22344 | { | ||
| 22345 | 253456 | ffcmap[i].clear(); | |
| 22346 | 253456 | } | |
| 22347 | |||
| 22348 | 496 | globalmap[0].slotname = "Slot 1:"; | |
| 22349 | 496 | globalmap[0].scriptname = "~Init"; | |
| 22350 | 496 | globalmap[0].update(); | |
| 22351 | |||
| 22352 |
2/2✓ Branch 0 taken 3472 times.
✓ Branch 1 taken 496 times.
|
3968 | for(int32_t i=1; i<NUMSCRIPTGLOBAL; i++) |
| 22353 | { | ||
| 22354 | 3472 | globalmap[i].clear(); | |
| 22355 | 3472 | } | |
| 22356 | |||
| 22357 |
2/2✓ Branch 0 taken 126480 times.
✓ Branch 1 taken 496 times.
|
126976 | for(int32_t i=0; i<NUMSCRIPTITEM-1; i++) |
| 22358 | { | ||
| 22359 | 126480 | itemmap[i].clear(); | |
| 22360 | 126480 | } | |
| 22361 | |||
| 22362 | //new script types -- prevent carrying over to a quest that you load after reading them | ||
| 22363 | //e.g., a quest has an npc script, and you make a blank quest, that now believes that it has an npc script, too! | ||
| 22364 |
2/2✓ Branch 0 taken 126480 times.
✓ Branch 1 taken 496 times.
|
126976 | for(int32_t i=0; i<NUMSCRIPTGUYS-1; i++) |
| 22365 | { | ||
| 22366 | 126480 | npcmap[i].clear(); | |
| 22367 | 126480 | } | |
| 22368 |
2/2✓ Branch 0 taken 126480 times.
✓ Branch 1 taken 496 times.
|
126976 | for(int32_t i=0; i<NUMSCRIPTWEAPONS-1; i++) |
| 22369 | { | ||
| 22370 | 126480 | lwpnmap[i].clear(); | |
| 22371 | 126480 | } | |
| 22372 |
2/2✓ Branch 0 taken 126480 times.
✓ Branch 1 taken 496 times.
|
126976 | for(int32_t i=0; i<NUMSCRIPTWEAPONS-1; i++) |
| 22373 | { | ||
| 22374 | 126480 | ewpnmap[i].clear(); | |
| 22375 | 126480 | } | |
| 22376 |
2/2✓ Branch 0 taken 1984 times.
✓ Branch 1 taken 496 times.
|
2480 | for(int32_t i=0; i<NUMSCRIPTHERO-1; i++) |
| 22377 | { | ||
| 22378 | 1984 | playermap[i].clear(); | |
| 22379 | 1984 | } | |
| 22380 |
2/2✓ Branch 0 taken 126480 times.
✓ Branch 1 taken 496 times.
|
126976 | for(int32_t i=0; i<NUMSCRIPTSDMAP-1; i++) |
| 22381 | { | ||
| 22382 | 126480 | dmapmap[i].clear(); | |
| 22383 | 126480 | } | |
| 22384 |
2/2✓ Branch 0 taken 126480 times.
✓ Branch 1 taken 496 times.
|
126976 | for(int32_t i=0; i<NUMSCRIPTSCREEN-1; i++) |
| 22385 | { | ||
| 22386 | 126480 | screenmap[i].clear(); | |
| 22387 | 126480 | } | |
| 22388 |
2/2✓ Branch 0 taken 126480 times.
✓ Branch 1 taken 496 times.
|
126976 | for(int32_t i=0; i<NUMSCRIPTSITEMSPRITE-1; i++) |
| 22389 | { | ||
| 22390 | 126480 | itemspritemap[i].clear(); | |
| 22391 | 126480 | } | |
| 22392 |
2/2✓ Branch 0 taken 253456 times.
✓ Branch 1 taken 496 times.
|
253952 | for(int32_t i=0; i<NUMSCRIPTSCOMBODATA-1; i++) |
| 22393 | { | ||
| 22394 | 253456 | comboscriptmap[i].clear(); | |
| 22395 | 253456 | } | |
| 22396 |
2/2✓ Branch 0 taken 253456 times.
✓ Branch 1 taken 496 times.
|
253952 | for(int32_t i=0; i<NUMSCRIPTSGENERIC-1; i++) |
| 22397 | { | ||
| 22398 | 253456 | genericmap[i].clear(); | |
| 22399 | 253456 | } | |
| 22400 |
2/2✓ Branch 0 taken 126480 times.
✓ Branch 1 taken 496 times.
|
126976 | for(int32_t i=0; i<NUMSCRIPTSSUBSCREEN-1; i++) |
| 22401 | { | ||
| 22402 | 126480 | subscreenmap[i].clear(); | |
| 22403 | 126480 | } | |
| 22404 | |||
| 22405 | 496 | reset_scripts(); | |
| 22406 | 496 | } | |
| 22407 | |||
| 22408 | 830 | zquestheader tempheader{}; | |
| 22409 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | tempheader.filename = filename; |
| 22410 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | zinfo tempzi; |
| 22411 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | tempzi.clear(); |
| 22412 | 830 | load_tmp_zi = &tempzi; | |
| 22413 | |||
| 22414 | char zinfofilename[2048]; | ||
| 22415 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | replace_extension(zinfofilename, filename, "zinfo", 2047); |
| 22416 | 830 | int32_t ret=0; | |
| 22417 | |||
| 22418 | //header | ||
| 22419 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | box_out("Reading Header..."); |
| 22420 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | ret=readheader(f, &tempheader, printmetadata); |
| 22421 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 830 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
830 | checkstatus(ret); |
| 22422 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | box_out("okay."); |
| 22423 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | box_eol(); |
| 22424 | |||
| 22425 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 615 times.
|
830 | if(read_zinfo) |
| 22426 | { | ||
| 22427 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | box_out("Reading ZInfo - "); |
| 22428 |
3/4✓ Branch 0 taken 3 times.
✓ Branch 1 taken 212 times.
✓ Branch 2 taken 215 times.
✗ Branch 3 not taken.
|
215 | box_out(read_ext_zinfo ? "External..." : "Internal..."); |
| 22429 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 212 times.
|
215 | if(read_ext_zinfo) |
| 22430 | { | ||
| 22431 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | PACKFILE *inf=pack_fopen_password(zinfofilename, F_READ, ""); |
| 22432 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | ret=readzinfo(inf, tempzi, tempheader); |
| 22433 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3 | if(inf) pack_fclose(inf); |
| 22434 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
3 | checkstatus(ret); |
| 22435 | 3 | } | |
| 22436 | else | ||
| 22437 | { | ||
| 22438 |
1/2✓ Branch 0 taken 212 times.
✗ Branch 1 not taken.
|
212 | ret=readzinfo(f, tempzi, tempheader); |
| 22439 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 212 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
212 | checkstatus(ret); |
| 22440 | } | ||
| 22441 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | box_out("okay."); |
| 22442 |
1/2✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
|
215 | box_eol(); |
| 22443 | 215 | } | |
| 22444 | |||
| 22445 |
2/2✓ Branch 0 taken 806 times.
✓ Branch 1 taken 24 times.
|
830 | if(tempheader.zelda_version>=0x193) |
| 22446 | { | ||
| 22447 | dword section_id; | ||
| 22448 | |||
| 22449 | //section id | ||
| 22450 |
2/4✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 806 times.
✗ Branch 3 not taken.
|
806 | if(!p_mgetl(§ion_id,f)) |
| 22451 | { | ||
| 22452 | ✗ | goto invalid; | |
| 22453 | } | ||
| 22454 | |||
| 22455 | 806 | std::set<dword> seen_sections; | |
| 22456 | |||
| 22457 |
3/4✓ Branch 0 taken 19760 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18954 times.
✓ Branch 3 taken 806 times.
|
19760 | while(!pack_feof(f)) |
| 22458 | { | ||
| 22459 |
2/4✓ Branch 0 taken 18954 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18954 times.
✗ Branch 3 not taken.
|
18954 | if (seen_sections.contains(section_id)) |
| 22460 | ✗ | goto invalid; | |
| 22461 |
1/2✓ Branch 0 taken 18954 times.
✗ Branch 1 not taken.
|
18954 | seen_sections.insert(section_id); |
| 22462 | |||
| 22463 |
3/4✓ Branch 0 taken 18954 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11961 times.
✓ Branch 3 taken 6993 times.
|
18954 | if (int retval = maybe_skip_section(f, section_id, skip_flags); retval != qe_OK) |
| 22464 | { | ||
| 22465 |
1/2✓ Branch 0 taken 6993 times.
✗ Branch 1 not taken.
|
6993 | if (retval == qe_cancel) |
| 22466 | 6993 | continue; | |
| 22467 | ✗ | checkstatus(retval); | |
| 22468 | ✗ | } | |
| 22469 | |||
| 22470 |
25/26✓ Branch 0 taken 473 times.
✓ Branch 1 taken 473 times.
✓ Branch 2 taken 806 times.
✓ Branch 3 taken 806 times.
✓ Branch 4 taken 473 times.
✓ Branch 5 taken 415 times.
✓ Branch 6 taken 806 times.
✓ Branch 7 taken 473 times.
✓ Branch 8 taken 473 times.
✓ Branch 9 taken 473 times.
✓ Branch 10 taken 473 times.
✓ Branch 11 taken 473 times.
✓ Branch 12 taken 415 times.
✓ Branch 13 taken 415 times.
✓ Branch 14 taken 473 times.
✓ Branch 15 taken 473 times.
✓ Branch 16 taken 415 times.
✓ Branch 17 taken 415 times.
✓ Branch 18 taken 415 times.
✓ Branch 19 taken 415 times.
✓ Branch 20 taken 473 times.
✓ Branch 21 taken 473 times.
✓ Branch 22 taken 415 times.
✓ Branch 23 taken 415 times.
✓ Branch 24 taken 132 times.
✗ Branch 25 not taken.
|
11961 | switch(section_id) |
| 22471 | { | ||
| 22472 | case ID_RULES: | ||
| 22473 | |||
| 22474 | //rules | ||
| 22475 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if(catchup) |
| 22476 | { | ||
| 22477 | ✗ | box_out("found."); | |
| 22478 | ✗ | box_eol(); | |
| 22479 | ✗ | catchup=false; | |
| 22480 | ✗ | } | |
| 22481 | |||
| 22482 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("Reading Rules..."); |
| 22483 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | ret=readrules(f, &tempheader); |
| 22484 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
473 | checkstatus(ret); |
| 22485 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("okay."); |
| 22486 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_eol(); |
| 22487 | 473 | break; | |
| 22488 | |||
| 22489 | case ID_STRINGS: | ||
| 22490 | |||
| 22491 | //strings | ||
| 22492 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if(catchup) |
| 22493 | { | ||
| 22494 | ✗ | box_out("found."); | |
| 22495 | ✗ | box_eol(); | |
| 22496 | ✗ | catchup=false; | |
| 22497 | ✗ | } | |
| 22498 | |||
| 22499 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("Reading Strings..."); |
| 22500 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | ret=readstrings(f, &tempheader); |
| 22501 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
473 | checkstatus(ret); |
| 22502 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("okay."); |
| 22503 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_eol(); |
| 22504 | 473 | break; | |
| 22505 | |||
| 22506 | case ID_MISC: | ||
| 22507 | |||
| 22508 | //misc data | ||
| 22509 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 806 times.
|
806 | if(catchup) |
| 22510 | { | ||
| 22511 | ✗ | box_out("found."); | |
| 22512 | ✗ | box_eol(); | |
| 22513 | ✗ | catchup=false; | |
| 22514 | ✗ | } | |
| 22515 | |||
| 22516 |
1/2✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
|
806 | box_out("Reading Misc. Data..."); |
| 22517 |
1/2✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
|
806 | ret=readmisc(f, &tempheader, Misc); |
| 22518 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 806 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
806 | checkstatus(ret); |
| 22519 |
1/2✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
|
806 | box_out("okay."); |
| 22520 |
1/2✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
|
806 | box_eol(); |
| 22521 | 806 | break; | |
| 22522 | |||
| 22523 | case ID_TILES: | ||
| 22524 | |||
| 22525 | //tiles | ||
| 22526 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 806 times.
|
806 | if(catchup) |
| 22527 | { | ||
| 22528 | ✗ | box_out("found."); | |
| 22529 | ✗ | box_eol(); | |
| 22530 | ✗ | catchup=false; | |
| 22531 | ✗ | } | |
| 22532 | |||
| 22533 |
1/2✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
|
806 | box_out("Reading Tiles..."); |
| 22534 |
1/2✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
|
806 | ret=readtiles(f, newtilebuf, &tempheader, tempheader.zelda_version, tempheader.build, 0, NEWMAXTILES, false); |
| 22535 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 806 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
806 | checkstatus(ret); |
| 22536 |
1/2✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
|
806 | box_out("okay."); |
| 22537 |
1/2✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
|
806 | box_eol(); |
| 22538 | 806 | break; | |
| 22539 | |||
| 22540 | case ID_COMBOS: | ||
| 22541 | |||
| 22542 | //combos | ||
| 22543 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if(catchup) |
| 22544 | { | ||
| 22545 | ✗ | box_out("found."); | |
| 22546 | ✗ | box_eol(); | |
| 22547 | ✗ | catchup=false; | |
| 22548 | ✗ | } | |
| 22549 | |||
| 22550 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("Reading Combos..."); |
| 22551 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | ret=readcombos(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXCOMBOS); |
| 22552 | 473 | combosread=true; | |
| 22553 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
473 | checkstatus(ret); |
| 22554 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("okay."); |
| 22555 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_eol(); |
| 22556 | 473 | break; | |
| 22557 | |||
| 22558 | case ID_COMBOALIASES: | ||
| 22559 | |||
| 22560 | //combo aliases | ||
| 22561 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if(catchup) |
| 22562 | { | ||
| 22563 | ✗ | box_out("found."); | |
| 22564 | ✗ | box_eol(); | |
| 22565 | ✗ | catchup=false; | |
| 22566 | ✗ | } | |
| 22567 | |||
| 22568 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_out("Reading Combo Aliases..."); |
| 22569 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | ret=readcomboaliases(f, &tempheader, tempheader.zelda_version, tempheader.build); |
| 22570 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
415 | checkstatus(ret); |
| 22571 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_out("okay."); |
| 22572 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_eol(); |
| 22573 | 415 | break; | |
| 22574 | |||
| 22575 | case ID_CSETS: | ||
| 22576 | |||
| 22577 | //color data | ||
| 22578 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 806 times.
|
806 | if(catchup) |
| 22579 | { | ||
| 22580 | ✗ | box_out("found."); | |
| 22581 | ✗ | box_eol(); | |
| 22582 | ✗ | catchup=false; | |
| 22583 | ✗ | } | |
| 22584 | |||
| 22585 |
1/2✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
|
806 | box_out("Reading Color Data..."); |
| 22586 |
1/2✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
|
806 | ret=readcolordata(f, Misc, tempheader.zelda_version, tempheader.build, 0, newerpdTOTAL); |
| 22587 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 806 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
806 | checkstatus(ret); |
| 22588 |
1/2✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
|
806 | box_out("okay."); |
| 22589 |
1/2✓ Branch 0 taken 806 times.
✗ Branch 1 not taken.
|
806 | box_eol(); |
| 22590 | 806 | break; | |
| 22591 | |||
| 22592 | case ID_MAPS: | ||
| 22593 | |||
| 22594 | //maps | ||
| 22595 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if(catchup) |
| 22596 | { | ||
| 22597 | ✗ | box_out("found."); | |
| 22598 | ✗ | box_eol(); | |
| 22599 | ✗ | catchup=false; | |
| 22600 | ✗ | } | |
| 22601 | |||
| 22602 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("Reading Maps..."); |
| 22603 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | ret=readmaps(f, &tempheader); |
| 22604 | 473 | mapsread=true; | |
| 22605 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
473 | checkstatus(ret); |
| 22606 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("okay."); |
| 22607 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_eol(); |
| 22608 | 473 | break; | |
| 22609 | |||
| 22610 | case ID_DMAPS: | ||
| 22611 | |||
| 22612 | //dmaps | ||
| 22613 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if(catchup) |
| 22614 | { | ||
| 22615 | ✗ | box_out("found."); | |
| 22616 | ✗ | box_eol(); | |
| 22617 | ✗ | catchup=false; | |
| 22618 | ✗ | } | |
| 22619 | |||
| 22620 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("Reading DMaps..."); |
| 22621 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | ret=readdmaps(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXDMAPS); |
| 22622 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
473 | checkstatus(ret); |
| 22623 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("okay."); |
| 22624 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_eol(); |
| 22625 | 473 | break; | |
| 22626 | |||
| 22627 | case ID_DOORS: | ||
| 22628 | |||
| 22629 | //door combo sets | ||
| 22630 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if(catchup) |
| 22631 | { | ||
| 22632 | ✗ | box_out("found."); | |
| 22633 | ✗ | box_eol(); | |
| 22634 | ✗ | catchup=false; | |
| 22635 | ✗ | } | |
| 22636 | |||
| 22637 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("Reading Doors..."); |
| 22638 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | ret=readdoorcombosets(f, &tempheader); |
| 22639 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
473 | checkstatus(ret); |
| 22640 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("okay."); |
| 22641 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_eol(); |
| 22642 | 473 | break; | |
| 22643 | |||
| 22644 | case ID_ITEMS: | ||
| 22645 | |||
| 22646 | //items | ||
| 22647 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if(catchup) |
| 22648 | { | ||
| 22649 | ✗ | box_out("found."); | |
| 22650 | ✗ | box_eol(); | |
| 22651 | ✗ | catchup=false; | |
| 22652 | ✗ | } | |
| 22653 | |||
| 22654 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("Reading Items..."); |
| 22655 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | ret=readitems(f, tempheader.zelda_version, tempheader.build); |
| 22656 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
473 | checkstatus(ret); |
| 22657 | |||
| 22658 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("okay."); |
| 22659 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_eol(); |
| 22660 | 473 | break; | |
| 22661 | |||
| 22662 | case ID_WEAPONS: | ||
| 22663 | |||
| 22664 | //weapons | ||
| 22665 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if(catchup) |
| 22666 | { | ||
| 22667 | ✗ | box_out("found."); | |
| 22668 | ✗ | box_eol(); | |
| 22669 | ✗ | catchup=false; | |
| 22670 | ✗ | } | |
| 22671 | |||
| 22672 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("Reading Weapons..."); |
| 22673 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | ret=readweapons(f, &tempheader); |
| 22674 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
473 | checkstatus(ret); |
| 22675 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("okay."); |
| 22676 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_eol(); |
| 22677 | 473 | break; | |
| 22678 | |||
| 22679 | case ID_COLORS: | ||
| 22680 | |||
| 22681 | //misc. colors | ||
| 22682 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if(catchup) |
| 22683 | { | ||
| 22684 | ✗ | box_out("found."); | |
| 22685 | ✗ | box_eol(); | |
| 22686 | ✗ | catchup=false; | |
| 22687 | ✗ | } | |
| 22688 | |||
| 22689 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_out("Reading Misc. Colors..."); |
| 22690 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | ret=readmisccolors(f, &tempheader, Misc); |
| 22691 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
415 | checkstatus(ret); |
| 22692 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_out("okay."); |
| 22693 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_eol(); |
| 22694 | 415 | break; | |
| 22695 | |||
| 22696 | case ID_ICONS: | ||
| 22697 | |||
| 22698 | //game icons | ||
| 22699 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if(catchup) |
| 22700 | { | ||
| 22701 | ✗ | box_out("found."); | |
| 22702 | ✗ | box_eol(); | |
| 22703 | ✗ | catchup=false; | |
| 22704 | ✗ | } | |
| 22705 | |||
| 22706 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_out("Reading Game Icons..."); |
| 22707 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | ret=readgameicons(f, &tempheader, Misc); |
| 22708 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
415 | checkstatus(ret); |
| 22709 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_out("okay."); |
| 22710 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_eol(); |
| 22711 | 415 | break; | |
| 22712 | |||
| 22713 | case ID_INITDATA: | ||
| 22714 | |||
| 22715 | //initialization data | ||
| 22716 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if(catchup) |
| 22717 | { | ||
| 22718 | ✗ | box_out("found."); | |
| 22719 | ✗ | box_eol(); | |
| 22720 | ✗ | catchup=false; | |
| 22721 | ✗ | } | |
| 22722 | |||
| 22723 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("Reading Init. Data..."); |
| 22724 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | ret=readinitdata(f, &tempheader); |
| 22725 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
473 | checkstatus(ret); |
| 22726 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("okay."); |
| 22727 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_eol(); |
| 22728 | |||
| 22729 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 473 times.
|
473 | if(!get_bit(skip_flags, skip_subscreens)) |
| 22730 | { | ||
| 22731 |
2/2✓ Branch 0 taken 93 times.
✓ Branch 1 taken 380 times.
|
473 | if(subscr_mode!=ssdtMAX) //not using custom subscreens |
| 22732 | { | ||
| 22733 |
1/2✓ Branch 0 taken 93 times.
✗ Branch 1 not taken.
|
93 | setupsubscreens(); |
| 22734 | |||
| 22735 |
2/2✓ Branch 0 taken 47616 times.
✓ Branch 1 taken 93 times.
|
47709 | for(int32_t i=0; i<MAXDMAPS; ++i) |
| 22736 | { | ||
| 22737 | 47616 | int32_t type=DMaps[i].type&dmfTYPE; | |
| 22738 |
2/2✓ Branch 0 taken 1070 times.
✓ Branch 1 taken 46546 times.
|
47616 | DMaps[i].active_subscreen=(type == dmOVERW || type == dmBSOVERW)?0:1; |
| 22739 | 47616 | DMaps[i].passive_subscreen=(get_qr(qr_ENABLEMAGIC))?0:1; | |
| 22740 | 47616 | } | |
| 22741 | 93 | } | |
| 22742 | 473 | } | |
| 22743 | |||
| 22744 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 473 times.
|
473 | if(!get_bit(skip_flags, skip_sfx)) |
| 22745 | { | ||
| 22746 | 473 | setupsfx(); | |
| 22747 | 473 | } | |
| 22748 | |||
| 22749 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 473 times.
✗ Branch 3 not taken.
|
473 | if(!get_bit(skip_flags, skip_itemdropsets)) |
| 22750 | { | ||
| 22751 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | init_item_drop_sets(); |
| 22752 | 473 | } | |
| 22753 | |||
| 22754 |
2/4✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 473 times.
|
473 | if(!get_bit(skip_flags, skip_favorites)) |
| 22755 | { | ||
| 22756 | 473 | init_favorites(); | |
| 22757 | 473 | } | |
| 22758 | |||
| 22759 | 473 | break; | |
| 22760 | |||
| 22761 | case ID_GUYS: | ||
| 22762 | |||
| 22763 | //guys | ||
| 22764 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if(catchup) |
| 22765 | { | ||
| 22766 | ✗ | box_out("found."); | |
| 22767 | ✗ | box_eol(); | |
| 22768 | ✗ | catchup=false; | |
| 22769 | ✗ | } | |
| 22770 | |||
| 22771 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("Reading Custom Guy Data..."); |
| 22772 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | ret=readguys(f, &tempheader); |
| 22773 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
473 | checkstatus(ret); |
| 22774 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("okay."); |
| 22775 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_eol(); |
| 22776 | 473 | break; | |
| 22777 | |||
| 22778 | case ID_HEROSPRITES: | ||
| 22779 | |||
| 22780 | //hero sprites | ||
| 22781 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if(catchup) |
| 22782 | { | ||
| 22783 | ✗ | box_out("found."); | |
| 22784 | ✗ | box_eol(); | |
| 22785 | ✗ | catchup=false; | |
| 22786 | ✗ | } | |
| 22787 | |||
| 22788 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_out("Reading Custom Hero Sprite Data..."); |
| 22789 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | ret=readherosprites(f, &tempheader); |
| 22790 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
415 | checkstatus(ret); |
| 22791 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_out("okay."); |
| 22792 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_eol(); |
| 22793 | 415 | break; | |
| 22794 | |||
| 22795 | case ID_SUBSCREEN: | ||
| 22796 | |||
| 22797 | //custom subscreens | ||
| 22798 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if(catchup) |
| 22799 | { | ||
| 22800 | ✗ | box_out("found."); | |
| 22801 | ✗ | box_eol(); | |
| 22802 | ✗ | catchup=false; | |
| 22803 | ✗ | } | |
| 22804 | |||
| 22805 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_out("Reading Custom Subscreen Data..."); |
| 22806 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | ret=readsubscreens(f); |
| 22807 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
415 | checkstatus(ret); |
| 22808 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_out("okay."); |
| 22809 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_eol(); |
| 22810 | 415 | break; | |
| 22811 | |||
| 22812 | case ID_FFSCRIPT: | ||
| 22813 | |||
| 22814 | //Freeform combo scripts | ||
| 22815 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if(catchup) |
| 22816 | { | ||
| 22817 | ✗ | box_out("found."); | |
| 22818 | ✗ | box_eol(); | |
| 22819 | ✗ | catchup=false; | |
| 22820 | ✗ | } | |
| 22821 | |||
| 22822 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_out("Reading FF Script Data..."); |
| 22823 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | ret=readffscript(f, &tempheader); |
| 22824 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
415 | checkstatus(ret); |
| 22825 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_out("okay."); |
| 22826 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_eol(); |
| 22827 | 415 | break; | |
| 22828 | |||
| 22829 | case ID_SFX: | ||
| 22830 | |||
| 22831 | //SFX data | ||
| 22832 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if(catchup) |
| 22833 | { | ||
| 22834 | ✗ | box_out("found."); | |
| 22835 | ✗ | box_eol(); | |
| 22836 | ✗ | catchup=false; | |
| 22837 | ✗ | } | |
| 22838 | |||
| 22839 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_out("Reading SFX Data..."); |
| 22840 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | ret=readsfx(f, &tempheader); |
| 22841 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
415 | checkstatus(ret); |
| 22842 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_out("okay."); |
| 22843 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_eol(); |
| 22844 | 415 | break; | |
| 22845 | |||
| 22846 | case ID_MIDIS: | ||
| 22847 | |||
| 22848 | //midis | ||
| 22849 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if(catchup) |
| 22850 | { | ||
| 22851 | ✗ | box_out("found."); | |
| 22852 | ✗ | box_eol(); | |
| 22853 | ✗ | catchup=false; | |
| 22854 | ✗ | } | |
| 22855 | |||
| 22856 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("Reading MIDIs..."); |
| 22857 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | ret=readmidis(f, &tempheader, tunes); |
| 22858 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
473 | checkstatus(ret); |
| 22859 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("okay."); |
| 22860 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_eol(); |
| 22861 | 473 | break; | |
| 22862 | |||
| 22863 | case ID_CHEATS: | ||
| 22864 | |||
| 22865 | //cheat codes | ||
| 22866 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
|
473 | if(catchup) |
| 22867 | { | ||
| 22868 | ✗ | box_out("found."); | |
| 22869 | ✗ | box_eol(); | |
| 22870 | ✗ | catchup=false; | |
| 22871 | ✗ | } | |
| 22872 | |||
| 22873 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("Reading Cheat Codes..."); |
| 22874 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | ret=readcheatcodes(f, &tempheader); |
| 22875 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 473 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
473 | checkstatus(ret); |
| 22876 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_out("okay."); |
| 22877 |
1/2✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
|
473 | box_eol(); |
| 22878 | 473 | break; | |
| 22879 | |||
| 22880 | case ID_ITEMDROPSETS: | ||
| 22881 | |||
| 22882 | //item drop sets | ||
| 22883 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if(catchup) |
| 22884 | { | ||
| 22885 | ✗ | box_out("found."); | |
| 22886 | ✗ | box_eol(); | |
| 22887 | ✗ | catchup=false; | |
| 22888 | ✗ | } | |
| 22889 | |||
| 22890 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_out("Reading Item Drop Sets..."); |
| 22891 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | ret=readitemdropsets(f, tempheader.zelda_version); |
| 22892 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
415 | checkstatus(ret); |
| 22893 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_out("okay."); |
| 22894 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_eol(); |
| 22895 | 415 | break; | |
| 22896 | |||
| 22897 | case ID_FAVORITES: | ||
| 22898 | |||
| 22899 | //favorite combos and combo aliases | ||
| 22900 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if(catchup) |
| 22901 | { | ||
| 22902 | ✗ | box_out("found."); | |
| 22903 | ✗ | box_eol(); | |
| 22904 | ✗ | catchup=false; | |
| 22905 | ✗ | } | |
| 22906 | |||
| 22907 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_out("Reading Favorite Combos..."); |
| 22908 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | ret=readfavorites(f, tempheader.zelda_version); |
| 22909 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
415 | checkstatus(ret); |
| 22910 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_out("okay."); |
| 22911 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | box_eol(); |
| 22912 | 415 | break; | |
| 22913 | |||
| 22914 | case ID_ADVMUSIC: | ||
| 22915 | |||
| 22916 | // advanced music | ||
| 22917 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
|
132 | if(catchup) |
| 22918 | { | ||
| 22919 | ✗ | box_out("found."); | |
| 22920 | ✗ | box_eol(); | |
| 22921 | ✗ | catchup=false; | |
| 22922 | ✗ | } | |
| 22923 | |||
| 22924 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | box_out("Reading Advanced Music..."); |
| 22925 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | ret = read_adv_music(f); |
| 22926 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
132 | checkstatus(ret); |
| 22927 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | box_out("okay."); |
| 22928 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | box_eol(); |
| 22929 | 132 | break; | |
| 22930 | |||
| 22931 | default: | ||
| 22932 | ✗ | if(!catchup) | |
| 22933 | { | ||
| 22934 | ✗ | box_out("Bad token! Searching..."); | |
| 22935 | ✗ | box_eol(); | |
| 22936 | ✗ | } | |
| 22937 | |||
| 22938 | ✗ | catchup=true; | |
| 22939 | ✗ | break; | |
| 22940 | } | ||
| 22941 | |||
| 22942 | |||
| 22943 |
1/2✓ Branch 0 taken 11961 times.
✗ Branch 1 not taken.
|
11961 | if(catchup) |
| 22944 | { | ||
| 22945 | //section id | ||
| 22946 | ✗ | section_id=(section_id<<8); | |
| 22947 | |||
| 22948 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 22949 | { | ||
| 22950 | ✗ | goto invalid; | |
| 22951 | } | ||
| 22952 | |||
| 22953 | ✗ | section_id+=tempbyte; | |
| 22954 | ✗ | } | |
| 22955 | |||
| 22956 | else | ||
| 22957 | { | ||
| 22958 | //section id | ||
| 22959 |
3/4✓ Branch 0 taken 11961 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11488 times.
✓ Branch 3 taken 473 times.
|
11961 | if(!pack_feof(f)) |
| 22960 | { | ||
| 22961 |
2/4✓ Branch 0 taken 11488 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11488 times.
✗ Branch 3 not taken.
|
11488 | if(!p_mgetl(§ion_id,f)) |
| 22962 | { | ||
| 22963 | ✗ | goto invalid; | |
| 22964 | } | ||
| 22965 | 11488 | } | |
| 22966 | } | ||
| 22967 | } | ||
| 22968 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 806 times.
|
806 | } |
| 22969 | else | ||
| 22970 | { | ||
| 22971 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | std::vector<std::tuple<std::string, int32_t, std::function<int32_t()>>> hardcoded_sections = { |
| 22972 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Rules", ID_RULES, [&](){ return readrules(f, &tempheader); }}, |
| 22973 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Strings", ID_STRINGS, [&](){ return readstrings(f, &tempheader); }}, |
| 22974 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Doors", ID_DOORS, [&](){ return readdoorcombosets(f, &tempheader); }}, |
| 22975 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "DMaps", ID_DMAPS, [&](){ return readdmaps(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXDMAPS); }}, |
| 22976 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Misc. Data", ID_MISC, [&](){ return readmisc(f, &tempheader, Misc); }}, |
| 22977 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Items", ID_ITEMS, [&](){ return readitems(f, tempheader.zelda_version, tempheader.build); }}, |
| 22978 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Weapons", ID_WEAPONS, [&](){ return readweapons(f, &tempheader); }}, |
| 22979 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Custom Guy Data", ID_GUYS, [&](){ return readguys(f, &tempheader); }}, |
| 22980 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Maps", ID_MAPS, [&](){ return readmaps(f, &tempheader); }}, |
| 22981 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Combos", ID_COMBOS, [&](){ return readcombos(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXCOMBOS); }}, |
| 22982 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Color Data", ID_CSETS, [&](){ return readcolordata(f, Misc, tempheader.zelda_version, tempheader.build, 0, newerpdTOTAL); }}, |
| 22983 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Tiles", ID_TILES, [&](){ return readtiles(f, newtilebuf, &tempheader, tempheader.zelda_version, tempheader.build, 0, NEWMAXTILES, false); }}, |
| 22984 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "MIDIs", ID_MIDIS, [&](){ return readmidis(f, &tempheader, tunes); }}, |
| 22985 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Cheat Codes", ID_CHEATS, [&](){ return readcheatcodes(f, &tempheader); }}, |
| 22986 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Init. Data", ID_INITDATA, [&](){ return readinitdata(f, &tempheader); }}, |
| 22987 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Custom Hero Sprite Data", ID_HEROSPRITES, [&](){ return readherosprites2(f, -1); }}, |
| 22988 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Up Default Item Drop Sets", ID_ITEMDROPSETS, [&](){ return readitemdropsets(f, -1); }}, |
| 22989 | }; | ||
| 22990 | |||
| 22991 | 24 | legacy_skip_flags = skip_flags; | |
| 22992 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 408 times.
|
1250 | for (auto& [desc, section_id, fn] : hardcoded_sections) |
| 22993 | { | ||
| 22994 |
1/2✓ Branch 0 taken 408 times.
✗ Branch 1 not taken.
|
408 | int section_enum = section_id_to_enum(section_id); |
| 22995 |
2/4✓ Branch 0 taken 408 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 408 times.
✗ Branch 3 not taken.
|
408 | bool skip = section_enum >= 0 && get_bit(skip_flags, section_enum); |
| 22996 |
2/2✓ Branch 0 taken 392 times.
✓ Branch 1 taken 16 times.
|
408 | if (skip) |
| 22997 | { | ||
| 22998 | // Nothing to read. | ||
| 22999 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 15 times.
|
16 | if (section_id == ID_RULES) |
| 23000 | 1 | continue; | |
| 23001 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 14 times.
|
15 | if (section_id == ID_GUYS) |
| 23002 | 1 | continue; | |
| 23003 | |||
| 23004 | // Haven't looked at how to skip these, because we don't need to currently: the only | ||
| 23005 | // usage of skip_flags currently is all off except: header and tiles (see `load_imagebuf`). | ||
| 23006 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 13 times.
|
14 | if (section_id == ID_MIDIS) |
| 23007 | 1 | continue; | |
| 23008 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 12 times.
|
13 | if (section_id == ID_CHEATS) |
| 23009 | 1 | continue; | |
| 23010 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 11 times.
|
12 | if (section_id == ID_INITDATA) |
| 23011 | 1 | continue; | |
| 23012 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 10 times.
|
11 | if (section_id == ID_HEROSPRITES) |
| 23013 | 1 | continue; | |
| 23014 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 9 times.
|
10 | if (section_id == ID_ITEMDROPSETS) |
| 23015 | 1 | continue; | |
| 23016 | 9 | } | |
| 23017 | |||
| 23018 | // Would be nice, but old sections mostly did not save section sizes. We could advance by | ||
| 23019 | // a specific amount, but it'd be a lot of work to get it right. So, for old quests, let's just | ||
| 23020 | // read all the sections even if requested to skip some. | ||
| 23021 | // if (int retval = maybe_skip_section(f, section_id, skip_flags); retval != qe_OK) | ||
| 23022 | // { | ||
| 23023 | // if (retval == qe_cancel) | ||
| 23024 | // continue; | ||
| 23025 | // checkstatus(retval); | ||
| 23026 | // } | ||
| 23027 | |||
| 23028 |
3/6✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 401 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 401 times.
✗ Branch 5 not taken.
|
802 | box_out(fmt::format("Reading {}...", desc).c_str()); |
| 23029 |
1/2✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
|
401 | ret = fn(); |
| 23030 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 401 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
401 | checkstatus(ret); |
| 23031 |
1/2✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
|
401 | box_out("okay."); |
| 23032 |
1/2✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
|
401 | box_eol(); |
| 23033 | } | ||
| 23034 | 24 | legacy_skip_flags = nullptr; | |
| 23035 | |||
| 23036 |
3/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 23 times.
✓ Branch 3 taken 1 times.
|
24 | if(!get_bit(skip_flags, skip_subscreens)) |
| 23037 | { | ||
| 23038 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | setupsubscreens(); |
| 23039 | |||
| 23040 |
2/2✓ Branch 0 taken 11776 times.
✓ Branch 1 taken 23 times.
|
11799 | for(int32_t i=0; i<MAXDMAPS; ++i) |
| 23041 | { | ||
| 23042 | 11776 | int32_t type=DMaps[i].type&dmfTYPE; | |
| 23043 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 11732 times.
|
11776 | DMaps[i].active_subscreen=(type == dmOVERW || type == dmBSOVERW)?0:1; |
| 23044 | 11776 | DMaps[i].passive_subscreen=(get_qr(qr_ENABLEMAGIC))?0:1; | |
| 23045 | 11776 | } | |
| 23046 | 23 | } | |
| 23047 | |||
| 23048 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | box_out("Setting Up Default Sound Effects..."); |
| 23049 | |||
| 23050 |
3/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 23 times.
|
24 | if(!get_bit(skip_flags, skip_sfx)) |
| 23051 | 23 | setupsfx(); | |
| 23052 | |||
| 23053 |
3/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 23 times.
✓ Branch 3 taken 1 times.
|
24 | if(!get_bit(skip_flags, skip_favorites)) |
| 23054 | 23 | init_favorites(); | |
| 23055 | |||
| 23056 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | box_out("okay."); |
| 23057 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | box_eol(); |
| 23058 |
1/3✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
24 | } |
| 23059 | |||
| 23060 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | init_spritelists(); |
| 23061 | |||
| 23062 | // check data | ||
| 23063 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | if(f) |
| 23064 | { | ||
| 23065 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | pack_fclose(f); |
| 23066 | 830 | } | |
| 23067 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | clear_quest_tmpfile(); |
| 23068 | |||
| 23069 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | if(!oldquest) |
| 23070 | { | ||
| 23071 |
2/4✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 830 times.
|
830 | if(exists(tmpfilename)) |
| 23072 | { | ||
| 23073 | ✗ | delete_file(tmpfilename); | |
| 23074 | ✗ | } | |
| 23075 | 830 | } | |
| 23076 | |||
| 23077 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 830 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
830 | if(fixffcs && combosread && mapsread) |
| 23078 | { | ||
| 23079 | ✗ | for(int32_t i=0; i<map_count; i++) | |
| 23080 | { | ||
| 23081 | ✗ | for(int32_t j=0; j<MAPSCRS; j++) | |
| 23082 | { | ||
| 23083 | ✗ | int c = TheMaps[(i*MAPSCRS)+j].numFFC(); | |
| 23084 | ✗ | for(int32_t m=0; m<c; m++) | |
| 23085 | { | ||
| 23086 | ✗ | if(combobuf[TheMaps[(i*MAPSCRS)+j].ffcs[m].data].type == cCHANGE) | |
| 23087 | ✗ | TheMaps[(i*MAPSCRS)+j].ffcs[m].flags|=ffc_changer; | |
| 23088 | ✗ | } | |
| 23089 | ✗ | } | |
| 23090 | ✗ | } | |
| 23091 | ✗ | } | |
| 23092 | |||
| 23093 |
3/4✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 496 times.
✓ Branch 3 taken 334 times.
|
830 | if (!get_bit(skip_flags, skip_rules)) |
| 23094 | { | ||
| 23095 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | bool should_hide = compat_qr_hide_bottom_pixels(tempheader); |
| 23096 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | al_trace("Note: qr_HIDE_BOTTOM_8_PIXELS %s via compat rule\n", should_hide ? "enabled" : "disabled"); |
| 23097 |
2/2✓ Branch 0 taken 73 times.
✓ Branch 1 taken 423 times.
|
496 | if (should_hide) |
| 23098 |
1/2✓ Branch 0 taken 73 times.
✗ Branch 1 not taken.
|
73 | set_qr(qr_HIDE_BOTTOM_8_PIXELS, 1); |
| 23099 | |||
| 23100 |
3/4✓ Branch 0 taken 327 times.
✓ Branch 1 taken 169 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 327 times.
|
496 | if (FFCore.quest_format[vCompatRule] < 77 && Header->is_z3) |
| 23101 | ✗ | set_qr(qr_LAYER6_STRINGS_OVER_SUBSCREEN, 1); | |
| 23102 | 496 | } | |
| 23103 | |||
| 23104 |
7/10✓ Branch 0 taken 62 times.
✓ Branch 1 taken 768 times.
✓ Branch 2 taken 62 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 61 times.
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 61 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 61 times.
✗ Branch 9 not taken.
|
830 | if(get_qr(qr_CONTFULL_DEP) && !get_bit(skip_flags, skip_rules) && !get_bit(skip_flags, skip_initdata)) |
| 23105 | { | ||
| 23106 |
1/2✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
|
61 | set_qr(qr_CONTFULL_DEP, 0); |
| 23107 |
1/2✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
|
61 | zinit.flags.set(INIT_FL_CONTPERCENT,true); |
| 23108 | 61 | zinit.cont_heart=100; | |
| 23109 | 61 | zinit.counter[crLIFE]=zinit.mcounter[crLIFE]; | |
| 23110 | 61 | } | |
| 23111 | |||
| 23112 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | box_out("Done."); |
| 23113 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | box_eol(); |
| 23114 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | box_end(false); |
| 23115 | |||
| 23116 |
3/4✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 497 times.
✓ Branch 3 taken 333 times.
|
830 | if(!get_bit(skip_flags, skip_header)) |
| 23117 | { | ||
| 23118 |
1/2✓ Branch 0 taken 497 times.
✗ Branch 1 not taken.
|
497 | *Header = tempheader; |
| 23119 | 497 | } | |
| 23120 |
3/4✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 496 times.
✓ Branch 3 taken 334 times.
|
830 | if(!get_bit(skip_flags, skip_zinfo)) |
| 23121 | { | ||
| 23122 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | ZI.copyFrom(tempzi); |
| 23123 | 496 | } | |
| 23124 | |||
| 23125 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 830 times.
|
830 | if(loading_tileset_flags & TILESET_CLEARMAPS) |
| 23126 | { | ||
| 23127 | ✗ | TheMaps.clear(); | |
| 23128 | ✗ | TheMaps.resize(MAPSCRS*1); | |
| 23129 | ✗ | map_count = 1; | |
| 23130 | ✗ | map_infos.clear(); | |
| 23131 | ✗ | map_infos.resize(1); | |
| 23132 | ✗ | } | |
| 23133 | |||
| 23134 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 830 times.
|
830 | if(loading_tileset_flags & TILESET_CLEARHEADER) |
| 23135 | { | ||
| 23136 | ✗ | memset(Header->password, 0, sizeof(Header->password)); | |
| 23137 | ✗ | memset(Header->minver, 0, sizeof(Header->minver)); | |
| 23138 | ✗ | memset(Header->title, 0, sizeof(Header->title)); | |
| 23139 | ✗ | memset(Header->author, 0, sizeof(Header->author)); | |
| 23140 | ✗ | memset(Header->version, 0, sizeof(Header->version)); | |
| 23141 | ✗ | Header->use_keyfile = 0; | |
| 23142 | ✗ | Header->dirty_password = false; | |
| 23143 | cvs_MD5Context ctx; | ||
| 23144 | ✗ | cvs_MD5Init(&ctx); | |
| 23145 | ✗ | cvs_MD5Update(&ctx, (const uint8_t*)"", 0); | |
| 23146 | ✗ | cvs_MD5Final(Header->pwd_hash, &ctx); | |
| 23147 | ✗ | } | |
| 23148 | |||
| 23149 |
3/4✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 496 times.
✓ Branch 3 taken 334 times.
|
830 | if (!get_bit(skip_flags, skip_maps)) |
| 23150 | { | ||
| 23151 | // Not needed, so release its memory. | ||
| 23152 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | old_combo_pages = {}; |
| 23153 | 496 | } | |
| 23154 | |||
| 23155 |
2/2✓ Branch 0 taken 334 times.
✓ Branch 1 taken 496 times.
|
830 | if (skipping_any) |
| 23156 |
1/2✓ Branch 0 taken 334 times.
✗ Branch 1 not taken.
|
334 | restore_prev_qstload_global_state(); |
| 23157 | |||
| 23158 | 830 | return qe_OK; | |
| 23159 | |||
| 23160 | invalid: | ||
| 23161 | // TODO: It's too easy to forget to jump to this label, and accidentally leave the file open. | ||
| 23162 | // Should wrap PACKFILE in a std::unique_pointer with a custom deallocator. | ||
| 23163 | ✗ | box_out("error."); | |
| 23164 | ✗ | box_eol(); | |
| 23165 | ✗ | box_end(true); | |
| 23166 | |||
| 23167 | ✗ | pack_fclose(f); | |
| 23168 | |||
| 23169 | ✗ | if(!oldquest) | |
| 23170 | { | ||
| 23171 | ✗ | if(exists(tmpfilename)) | |
| 23172 | { | ||
| 23173 | ✗ | delete_file(tmpfilename); | |
| 23174 | ✗ | } | |
| 23175 | ✗ | } | |
| 23176 | |||
| 23177 | ✗ | restore_prev_qstload_global_state(); | |
| 23178 | |||
| 23179 | ✗ | return qe_invalid; | |
| 23180 | |||
| 23181 | 830 | } | |
| 23182 | |||
| 23183 | 333 | std::string get_last_loaded_qstpath() | |
| 23184 | { | ||
| 23185 | 333 | return last_loaded_qstpath; | |
| 23186 | } | ||
| 23187 | |||
| 23188 | 830 | int32_t loadquest(const char *filename, zquestheader *Header, miscQdata *Misc, | |
| 23189 | zctune *tunes, bool show_progress, byte *skip_flags, byte printmetadata, | ||
| 23190 | bool report, byte qst_num, dword tilesetflags) | ||
| 23191 | { | ||
| 23192 | 830 | loading_tileset_flags = tilesetflags; | |
| 23193 | 830 | const char* basename = get_filename(filename); | |
| 23194 | 830 | zapp_reporting_add_breadcrumb("load_quest", basename); | |
| 23195 | 830 | zapp_reporting_set_tag("qst.filename", basename); | |
| 23196 | |||
| 23197 | 830 | last_loaded_qstpath = filename; | |
| 23198 | 830 | loading_qst_name = filename; | |
| 23199 | 830 | loading_qst_num = qst_num; | |
| 23200 | // In CI, builds are cached for replay tests, which can result in their build dates being earlier than what it would be locally. | ||
| 23201 | // So to avoid a more-recently updated .qst file from hitting the "last saved in a newer version" prompt, we disable in CI. | ||
| 23202 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | if (!is_ci()) |
| 23203 | ✗ | loadquest_report = report; | |
| 23204 | |||
| 23205 | 830 | auto start = std::chrono::steady_clock::now(); | |
| 23206 | 830 | zprint2("Loading qst: %s\n", filename); | |
| 23207 | 830 | int32_t ret = _lq_int(filename, Header, Misc, tunes, show_progress, skip_flags, printmetadata); | |
| 23208 | 830 | int32_t load_ms = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - start).count(); | |
| 23209 | 830 | zprint2("Time to load qst: %d ms\n", load_ms); | |
| 23210 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | if (ret) |
| 23211 | ✗ | zprint2("Error: %s\n", qst_error[ret]); | |
| 23212 | |||
| 23213 |
1/2✓ Branch 0 taken 830 times.
✗ Branch 1 not taken.
|
830 | if(show_progress) |
| 23214 | { | ||
| 23215 | ✗ | if(ret) | |
| 23216 | { | ||
| 23217 | ✗ | box_out("-- Error loading quest file! --"); | |
| 23218 | ✗ | box_out(fmt::format("Error: {}", qst_error[ret]).c_str()); | |
| 23219 | ✗ | box_end(true); | |
| 23220 | ✗ | } | |
| 23221 | ✗ | else box_end(false); | |
| 23222 | ✗ | } | |
| 23223 | |||
| 23224 | 830 | load_tmp_zi = NULL; | |
| 23225 | 830 | loading_qst_name = NULL; | |
| 23226 | 830 | loadquest_report = false; | |
| 23227 | 830 | loading_qst_num = 0; | |
| 23228 | |||
| 23229 | 830 | zapp_reporting_set_tag("qst.author", Header->author); | |
| 23230 | 830 | zapp_reporting_set_tag("qst.title", Header->title); | |
| 23231 | 830 | zapp_reporting_set_tag("qst.zc_version", Header->getVerStr()); | |
| 23232 | |||
| 23233 | 830 | return ret; | |
| 23234 | ✗ | } | |
| 23235 |